[Gllug] C function strcasecmp

Nix nix at esperi.demon.co.uk
Sat Aug 4 00:00:26 UTC 2001


On Mon, 30 Jul 2001, home at alexhudson.com stipulated:
> On Mon, Jul 30, 2001 at 03:27:42PM +0100, Mark Hemment wrote:
>> It cannot always get it right - as there is no right way (it is
>> undefined).
>
> What I meant was, it gets the answer right in every different interpretation
> of the statement (post-increment before the add, post-increment after the
> add, etc..). This obviously isn't the case with all ambiguous statements.

No. The set of `different interpretations' of a translation unit
containing code that invokes undefined behaviour is unbounded; the
compiler may do anything at all, including issuing a division by zero
error, reformatting the hard disk, playing `Auld Lang Syne', or making
Ontario disappear. All are valid under the Standard; it does not impose
*any* constraints upon the compiler's behaviour then, because the
language that is being used is not the language which the Standard
defines.

Where implementation-defined behaviour is concerned, you are correct;
for instance, whether plain `char' is signed or unsigned is
implementation-defined. Where undefined behaviour (like modifying one
variable twice between sequence points) is concerned, you are
incorrect. Anything can happen --- and sometimes does...

-- 
`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