[Gllug] C function strcasecmp

Nix nix at esperi.demon.co.uk
Sun Jul 29 17:44:40 UTC 2001


On Sat, 28 Jul 2001, Alex Hudson stipulated:
> On Sat, Jul 28, 2001 at 11:06:44AM +0100, Alex Hudson wrote:
>> > > 	*x+=~(*x)++;
>> > 
>> > Foul and invokes undefined behaviour; multiple modifications with no
>> > intervening sequence points ;P
>> 
>> Given it worked when I compiled it, that's enough QA for participation in
>> this thread I feel ;) 
> 
> Actually, thinking about it - who cares if it's out of sequence? Doesn't
> matter :) (I think - assuming it wasn't being calculated in parallel,
> anyway).

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.

(Also, think what would happen if `x' needed multiple instructions to
address, there was a carry, and the system reordered execution so that
the += was done (perhaps partially) before the addition.

Oops, you've got 1, not 0.

> Obviously great code :)

Oh yes. Wonderful.

-- 
`It's all about bossing computers around. Users have to say "please".
Programmers get to say "do what I want NOW or the hard disk gets it".'
                        -- Richard Heathfield on the nature of programming

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




More information about the GLLUG mailing list