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

Re: Implementation-defined behaviour

Subject: Re: Implementation-defined behaviour
From: pete
Date: Fri, 28 Mar 2008 20:25:48 -0500
Newsgroups: comp.lang.c

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

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