comp.lang.c
[Top] [All Lists]

Re: Implementation-defined behaviour

Subject: Re: Implementation-defined behaviour
From: Richard Heathfield
Date: Fri, 28 Mar 2008 07:22:08 +0000
Newsgroups: comp.lang.c

Dann Corbit said:

> "Barry Schwarz" <schwarzb@xxxxxxxx> wrote in message
> news:c80pu39ghqdnumqju6mk2qgktt751hb7bn@xxxxxxxxxx
<snip>
>>>    printf("%d %d\n", n++, n);
>>>foo.c(8) : Warning 564: variable 'n' depends on order of evaluation
>>
>> The correct diagnostic would state: without an intervening sequence
>> point, n is modified and also evaluated for a purpose other than
>> determining the modified value.  This invokes undefined behavior.
> 
> The examination of n in the last parameter of printf() is to determine
> its value.

More to the point, it is /not/ to determine the /modified/ value.

> I am not sure that your interpretation is certain.  Are you sure of it?

If he isn't, he should be.

-- 
Richard Heathfield <http://www.cpax.org.uk>
Email: -                                www">http://www. +rjh@
Google users: <                                www.cpax.org.uk/prg/writings/googly.php">http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy