Re: ANSI standards


Subject: Re: ANSI standards
From: Thomas Fletcher (thomasf@qnx.com)
Date: Thu Jan 20 2000 - 08:16:24 CST


On Thu, 20 Jan 2000, sam th wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> According to bug 238, several string manipulation functions that we use
> are not ansi standard. I did some checking, and here are the platforms on
> which we use the functions in question:
>
> strdup
> BEOS Unix QNX

/* Everything here is ANSI */
char *UT_strdup(const char *str) {
        char *ret

        if (!str || !(ret = (char *)malloc(strlen(str) + 1))) {
                return NULL;
        }
        strcpy(ret, str);
}

> stricmp, strnicmp
> Win32 QNX
>
> strcasecmp, strncasecmp
> BEOS
>
> Are these really not ansi standard? the compiler on linux is set to give
> every warning possible, and it doesn't complain about strdup. What about
> the other platforms? Does this need to be fixed?
> By the way, this was in my ZAPing of the Release Practicies POW.
>

There is to my knowledge no ANSI standard way of doing
a case comparison. You can iterate through the string
with toupper/tolower before doing a character comparison
however.

Thomas

-------------------------------------------------------------
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf



This archive was generated by hypermail 2b25 : Thu Jan 20 2000 - 08:16:13 CST