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

Re: Implementation-defined behaviour

Subject: Re: Implementation-defined behaviour
From: "Dann Corbit"
Date: Fri, 28 Mar 2008 01:03:18 -0700
Newsgroups: comp.lang.c

"Richard Heathfield" <rjh@xxxxxxxxxxxxxxx> wrote in message 
news:Je-dnRR_6JCBOHHaRVnyjAA@xxxxxxxxx
> Dann Corbit said:
>
> <snip>
>>
>> How about:
>> printf("%d %d\n", ++n, n);
>>
>> In this case one could possibly argue that the intent is to determine the
>> modified value.
>
> The intent might be. Nevertheless, the *purpose* is not (because the order
> of evaluation of function arguments is unspecified).
>
>> While I agree it is an awful construct, I think that 'purpose' renders
>> the statement a bit ambiguous, because it implies intent.
>
> I don't think so, actually. Intent implies the possibility of mistaken
> execution of that intent, which would in turn require the implementation
> to read minds! No: *irrespective* of the intent, the *purpose* cannot be
> to determine the modified value, in either the "%d %d\n", ++n, n or the
> "%d %d\n", n, ++n case, because in neither case is the evaluation order
> specified.

I'm convinced. 



-- 
Posted via a free Usenet account from http://www.teranews.com


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