[Gllug] C function strcasecmp

Mark Hemment markhe at veritas.com
Sun Jul 29 19:48:30 UTC 2001


On Sun, 29 Jul 2001 home at alexhudson.com wrote:

> On Sun, Jul 29, 2001 at 06:44:40PM +0100, Nix wrote:
> > You misunderstand the meaning of `undefined'. It doesn't mean
> > *anything*; it's not in C. The compiler is quite within its rights to
> > generate code that reformats the disk, or that runs nethack; it doesn't
> > just affect order-of-execution.
>
> I don't think it is within it's rights to do that. The only issue here is
> the postincrement, surely? Which is a non-issue in this instance. Given the
> code compiles cleanly, even -Wall -pedantic, I think that pretty much makes
> it valid C. I disagree with your definition of undefined in this instance
> also - while that could apply to APIs, I don't see how that applies to
> language constructs. I also can't find any reference to that definition in
> the C standards - where did you find it?


  You are correct in one respect; it is not allowed to re-format the disk,
etc.
  There is a difference between illegal constructs and undefined behaviour
within the C language.  With undefined behaviour the compiler still has
rules to follow.  But under some conditions, one/some of those rules are
"open", and can change from compiler-to-compiler (and even from
optimization level to optimization level).
 They make good interview questions.

  Have a read of;
	http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/n926.htm
it gives a formal, but not difficult to follow, overview of sequence
points.

Mark



-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list