[Proj] Modern C functions
Gerald I. Evenden
geraldi.evenden at gmail.com
Fri Feb 27 10:19:44 EST 2009
On Thursday 26 February 2009 10:31:58 pm Glynn Clements wrote:
> Gerald I. Evenden wrote:
> > This is a quick probe of the programming types in this group.
> >
> > In finalizing Rel. 2.0 of geodesic and libgeodesy I ran across functions
> > under the <string.h> heading which are not in the typical (read Harrison
> > & Steele) library references: strcasecmp and strncasecmp. These are
> > noted in the Gnu man.3 as Posix 2001 standard routines. Obviously, these
> > two routines replace strcmp and strncmp and make comparisons case
> > independent.
> >
> > As soon as I became aware of them I have included them to eliminate the
> > nasty, nasty fact of having to shift when typing in WGS84 and can now use
> > ellps=wgs84.
> >
> > A little net browsing has yielded mixed results as to how well know these
> > functions are.
> >
> > Thus my question here is: do non-Gnu C compilers used by this audience
> > recognize these functions?
>
> It's not an issue for the compiler, but for the standard library.
IMHO, when discussing in a general context, the term "compiler" consists of
the entire process of generating an executable module and all it constituent
pieces. Including libraries.
> The are specified by POSIX, but not by ANSI C (neither C89 nor C99).
I have not concerned myself with "ANSI" in 15+ years as it seems superfluous
with so many other "standards" around.
> As others have already pointed out, Windows doesn't provide them.
> Also, gcc won't recognise them if you use -ansi and don't explicitly
> add the POSIX feature macros, e.g. -D_POSIX_SOURCE. I don't know
> whether uclibc has them.
The term "uclibc" does not make sense to me. I am only used to the
terminology libxxxxx. The "uc" prefix seems odd.
As for Windoze, I understand that there are non-M$ compilers available for
Windoze and these may not be so self righteous.
> Also, bear in mind that the behaviour depends upon the locale; using
> them for strings containing anything other than alphanumeric
> characters is problematic.
Seemingly the most common usage is for equality: strXcmp(a,b)==0. I see no
hassle with testing anything within the character set as long as str a and
str b are of the same character set type. But yes, there may be some
problems with some non-Latin alphabetics. However, in the context of a given
program and its control of the alphabet---like geodesic, proj, etc.---then we
are only testing against an in-house alphabet. If someone wants to convert a
program into using a non-latin alphabet, then the problem is transferred to
their domain.
--
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist
More information about the Proj
mailing list