Discussion:
Non void procedures with no return statement
(too old to reply)
A. Venkateswaran
2004-07-17 18:55:53 UTC
Permalink
If a non-void procedure does not contain a return statement, what should the compiler do? Is it alright to throw an exception? I see that the SL spec says "If a procedure ends by falling off the end, the return value is unspecified" - does that mean we should always simply return zeros (or some garbage value) regardless of the return type?

Thanks in advance,

Anandh
Troy Mark Gonsalves
2004-07-20 18:39:26 UTC
Permalink
You don't need to do anything special...just leave $1 with whatever value
it already has. In general, it's up to the SL-Programmer to ensure that
they return a value when necessary.
Post by A. Venkateswaran
If a non-void procedure does not contain a return statement, what should the compiler do? Is it alright to throw an exception? I see that the SL spec says "If a procedure ends by falling off the end, the return value is unspecified" - does that mean we should always simply return zeros (or some garbage value) regardless of the return type?
Thanks in advance,
Anandh
Continue reading on narkive:
Loading...