Re: empty expression lists in return statements?

From: Ross Bencina (rossb@audiomulch.com)
Date: Thu Aug 24 2000 - 16:33:26 EDT


John Lazzaro wrote:
>The key issue that should be clarified, I would think, would be the
>width and value that should be returned by a return() line (or
>alternatively, by "falling through" to the end of the opcode w/o
>hitting a return statement).

If return is not allowed inside if/else/while then a return statement with
an empty expression list is not needed. On the other hand if it is allowed
in if/else/while then a return with an empty expression list would be truly
useful. If zero width returns are allowed I would like to advocate making
the parenthesis optional for a zero width return statement. eg:

return;

This would be in line with C syntax.

The issue of determining behaviour when a UDO has a return width of zero
needs to be clarified independently of the empty return list / return list
inside if/else/while issues.

In C you can't use a void function as a value in an expression (it's type is
void.) In SAOL I would suggest that likewise a UDO with a return width of
zero may not be used in an expression. I can't see that this would increase
compiler complexity as the width of a UDO has to be determined to
width-check expressions anyway.

Best wishes,

Ross.



This archive was generated by hypermail 2b29 : Mon Jan 28 2002 - 12:03:58 EST