Efficient STRing CoMPares?

Doug Gwyn gwyn at smoke.brl.mil
Thu Mar 21 10:55:09 AEST 1991


In article <MARC.91Mar20080239 at marc.watson.ibm.com> marc at arnor.UUCP (Marc Auslander) writes:
>A correct compiler cannot inline strcmp unless it is given
>extralingual permission to do so - for example in a pragma or by
>defining some reserved symbol or by some other means.  This is because
>it is legal to combine a program which uses strcmp with another which
>defines it to by anything at all!

Conforming implementations ARE allowed to in-line the standard library
functions.  They must also provide external functions for most of them,
in case some application decides it needs a pointer to one of those
functions, etc.

It is true that a strictly conforming program is allowed to #define
strcmp, under certain circumstances, but that is not an issue.  It is
the use of "strcmp" as an identifier with external linkage that an
in-lining compiler must key on.

It is also possible for <string.h> to #define strcmp __strcmp and have
the compiler in-line __strcmp instead of strcmp.  This may make it
slightly easier for the implementation to support access to the
external-function definition of strcmp mentioned in my first paragraph.



More information about the Comp.lang.c mailing list