-----Original Message----- From: gpc-owner@gnu.de [mailto:gpc-owner@gnu.de]On Behalf Of Frank Heckenbach Sent: 11 January 2002 16:37 To: gpc@gnu.de Subject: Re: boolean function return value wrong
<snip>
You use `Return' without parameters which returns an arbitrary (undefined) value.
Ah. A hangover from Pascals from DEC/VS/Sparc which don't want a value (last value assigned to the function name is used).
I can't see any way an "undefined" return value is useful so why is it just a warning since it's almost bound to produce bad code?
If you compile with `-Wall' (always recommended), you'll see this problem immediately.
Sadly I get thousands of warnings like that (case statements where not all values checked mostly).
You can use `Exit' instead of `Return' to avoid this problem. Both are non-standard, BTW (`Exit' compatible to BP, `Return' to C-; and perhaps some other Pascal compilers).
Just what I need. I looked at the return man page but it's a "to be supplied" page and didn't reference the exit command.
The "clean" solution, and very easy to do here, would be to use an `else' branch.
Too much existing code.
Thanks for the excellent help again Frank.
Cheers, Martin.