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

Re: Implementation-defined behaviour

Subject: Re: Implementation-defined behaviour
From: Richard Tobin
Date: 28 Mar 2008 12:30:20 GMT
Newsgroups: comp.lang.c

In article <fsinrj$140r$1@xxxxxxxxxxxxxxxxxxx>,
Ioannis Vranos  <ivranos@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

>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 undefined behaviour, and therefore implementation dependent, but
"implementation defined" means that the implementation specifies (in
its documentation) what it does.  The standard contains a list of the
behaviours that the implementation must specify, but this isn't one of
them.

-- Richard
-- 
:wq

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