Mail Archives: djgpp/1997/08/04/10:32:02

From: Christopher Croughton <crough45 AT amc DOT de>
Message-Id: <>
Subject: Re: "Missing" functions
To: J DOT Bischoff AT airbus DOT dasa DOT de (Jens Bischoff)
Date: Mon, 4 Aug 1997 15:28:26 +0100
Cc: crough45 AT amc DOT de, djgpp AT delorie DOT com
In-Reply-To: <9708041259.AA23701@hpschrot.bre.da> from "Jens Bischoff" at Aug 4, 97 03:59:17 pm
Mime-Version: 1.0

Jens Bischoff wrote:
> Are you sure that "strcasecmp" is not part of the ANSI-C-string
> library routines?

ANSI X3.159-1989 (ISO 9899:1990) does not give it.  In section 7.11.4 
"Comparison Functions" it lists memcmp, strcmp, strcoll, strncmp, and 
the weird strxfrm function (convert a locale-dependent string to one
which will give the same results under strcmp - don't ask me, it's a 
strange name for a stranger function).

> At least on my machine there's no "stricmp", but "strcasecmp".
> And a test program with "strcasecmp" in it compiles & runs
> without error or warnings  when the ANSI-C compiler switch is set.

The DEC Alpha library, which as far as I can tell is pure ANSI (at
least it claims to be and I haven't caught it out yet) has neither.
It does have extensions, but not as far as I've seen in the standard
header files (most are in <unistd.h>, a Unix specific header).  This
thread is the first time I've heard of 'strcasecmp', no other library
I've used has had it and being nonstandard I've avoided looking for
similar functions because I try to write maximally portable code.

Using your own compiler or library as a baseline, in the context of
"well my compiler accepts it so it must be OK", is an often warned-
about mistake (and, it seems, just as often ignored).  Most compilers
and libraries have extensions, the GNU and DJGPP ones more than many
others (DJGPP, in particular, tries to be compatible with many features
of other DOS libraries and header files as well as all the Unix ones;
it's amazing that it does so with so few clashes between similar-named

The other way around, "My compiler rejects it so it must be bad", is
more reliable, modulo compiler bugs (which if they breach the standard 
are serious, the compiler vendors could be forced to take it off the 
market or display its non-compatibility if they didn't correct the 

Adding a -ansi or similar compiler switch rarely does anything about the
library.  It occasionally will cause a "missing prototype" warning (but
often you have to explicitly switch that on to see it), but most 
manufacturers don't seem to bother to take out prototypes.

Chris C

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019