Connecting Tech Pros Worldwide Help | Site Map

Re: No return in LONG InterlockedDecrement ( LONG *lpAddend )

David Thompson
Guest
 
Posts: n/a
#1: Sep 7 '08
On Wed, 27 Aug 2008 21:15:29 -0500, Jack Klein <jackklein@spamcop.net>
wrote:
Quote:
On Wed, 27 Aug 2008 01:02:11 -0700 (PDT), Nick Keighley
<nick_keighley_nospam@hotmail.comwrote in comp.lang.c:
>
Quote:
On 27 Aug, 06:22, slackcode <slackc...@gmail.comwrote:
<snip: valued function that 'falls off end'>
Quote:
Quote:
that is an error. Or more formally "Undefined Behaviour".
The implementation can do whatever it likes.
>
This function and it's execution are undefined in C90, but not in C99.
>
<snip: call that uses value>
Quote:
It is in the line above, where the caller uses the value that the
function failed to return, that undefined behavior occurs in C99. And
of course, any other place where callers of the function happen to use
the value.
>
No, in C90 also it is (or was) UB only if the value is used. It's just
described in a different place: 6.6.6.4 return statement rather than
6.9.1p12 function definition. Two things that did change are:

- in C99 it is a constraint violation to have an explicit return
/*novalue*/; statement in a valued function (so that method of
returning indeterminate is gone, but fall-off-end is still there)

- in C99 fall-off-end of (initial call of) main() returns status 0
(success) rather than undefined

- formerly david.thompson1 || achar(64) || worldnet.att.net
Closed Thread