[LCP]query regarding pointers in C
Jack Lloyd
lloyd at acm.jhu.edu
Fri Apr 16 22:59:01 UTC 2004
On Fri, Apr 16, 2004 at 11:12:18AM +0100, David Spencer wrote:
> correct and what they think isn't by not posting can be difficult. Last
> time I checked, this list was "linux c programming", not "Standard C
> programming" or "comp.lang.c" so I would have thought questions about
> actual, rather than standard, behaviour would have been ON topic.
But odds are that different versions of GCC, or the same version of GCC on
different architectures, or another Linux C compiler (KAI, ICC, etc) will
produce different results. Even just constrained to C programming on Linux,
there are a wide variety of behaviors that might exist, all of them
undocumented and changing from version to version.
That is not to say that it's not an interesting discussion, compilers are neat
beasts. But to present any behavior as expected or typical seems like it could
be very misleading. And then when things stop working, people file bug reports
with GCC, and the GCC folks get very irate. :)
While indeed this is not comp.lang.c, this is a canonical "monkeys fly out of
your nose" case. (For those who have not heard of this: basically, if ISO C
says "such and such is undefined", then the compiler can do anything at all it
likes. For example (in this case), it might use a random number generator to
decide which subexpression to evaluate first each time the function was
called. Or it might make monkeys fly out of your nose (unlikely, but allowed by
ISO C)).
-Jack
More information about the linuxCprogramming
mailing list