[LCP]what value does the foo() return?
Greg Black
gjb at gbch.net
Tue Jan 6 18:53:38 UTC 2004
On 2004-01-06, Paul Gearon wrote:
> Greg Black wrote:
> > Incorrect
> >programs, e.g., those that exhibit undefined behaviour, are just
> >incorrect programs and their behaviour is not interesting.
>
> I'll disagree here, but it really does depend on what you mean by
> "interesting".
OK, but my definition excludes this sort of stuff, except when
I'm trying to debug (somebody else's) code ...
> So knowledge of undefined behaviour in a specific system can *sometimes*
> help. :-)
All sorts of (possibly quite arcane) knowledge can, and does,
help when it comes to debugging -- but this thread was about
putting the bugs in, not getting them out ...
> Back to the question of a missing return value in a return path; Ideally
> your compiler will be good enough to spot undefined behaviour of such a
> gross nature as this. One should NEVER allow a warning like that to
> continue to exist.
Indeed -- but it's worth noting that compilers are not required
to give diagnostics for undefined code. Obviously, you'd tend
to choose a compiler that did go the extra mile to provide such
useful warnings; and it would be utter folly to ignore them.
Cheers, Greg
More information about the linuxCprogramming
mailing list