Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 400
    • Issues 400
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #1866
Closed
Open
Created Mar 01, 2012 by Bep Rinto@broGuest

strange or inconsistent parsing of multiple return values

Bugzilla Link 925
Created on Mar 01, 2012 13:11
Resolution WORKSFORME
Resolved on Apr 21, 2012 18:46
Version 1.00beta
OS Linux
Architecture PC

Extended Description

The multiple-return value parsing feels strange in several respects.
First it requires parentheses. C doesn't require parentheses for
a return value. One can write:
   return value;
But in SAC this doesn't work for multiple return values:
ABORT: line 11  file: testcomma.sac
ABORT: syntax error at pos 13: ',`
ABORT:     return a, b;
ABORT:             ^
This code works when it is changed to "return (a, b);".
Second the multiple return value cannot be used
in combination with the ternary conditional operator:
ABORT: line 13  file: testcomma.sac
ABORT: syntax error at pos 26: ',`
ABORT:     return ((k <= 1) ? (a, b) : (c, d));
ABORT:                          ^
To make this code work one has to revert to tedious code like:
    e = (k <= 1) ? a : c;
    f = (k <= 1) ? b : d;
    return (e, f);
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking