Re: Implementation-defined behaviour
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 20:25:48 -0500
CBFalconer wrote:
pete wrote:
Ioannis Vranos wrote:... snip ...
K&R2 mentions the following:
"printf("%d %d\n", ++n, power(2,n)); /* WRONG */
can produce different results with different compilers, depending
on whether n is incremented before power is called".
That's why I call it implementation-defined behaviour.
It's unspecified behavior. The power(2,n) function call,
introduces a sequence point that the other code examples don't
have. This is all about sequence points.
Not quite. Also order of parameter evaluation.
By "this" I was refering to OP's confusion
about what was undefined
versus implementation defined and unspecified behavior.
--
pete
.
- References:
- Implementation-defined behaviour
- From: Ioannis Vranos
- Re: Implementation-defined behaviour
- From: Eric Sosman
- Re: Implementation-defined behaviour
- From: Ioannis Vranos
- Re: Implementation-defined behaviour
- From: Ian Collins
- Re: Implementation-defined behaviour
- From: Ioannis Vranos
- Re: Implementation-defined behaviour
- From: Andrey Tarasevich
- Re: Implementation-defined behaviour
- From: Ioannis Vranos
- Re: Implementation-defined behaviour
- From: pete
- Re: Implementation-defined behaviour
- From: CBFalconer
- Implementation-defined behaviour
- Prev by Date: restrict keyword questions
- Next by Date: Re: Implementation-defined behaviour
- Previous by thread: Re: Implementation-defined behaviour
- Next by thread: Re: Implementation-defined behaviour
- Index(es):
Relevant Pages
|