tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: using the interfaces in ctype.h




On 21-Apr-08, at 2:56 PM, Joerg Sonnenberger wrote:

On Mon, Apr 21, 2008 at 02:43:20PM -0400, Greg A. Woods; Planix, Inc. wrote:

On 21-Apr-08, at 1:57 PM, Joerg Sonnenberger wrote:

On Mon, Apr 21, 2008 at 01:52:41PM -0400, Greg A. Woods; Planix, Inc.
wrote:
Actually, no, it doesn't, at least on NetBSD.   Try it!  :-)

Sure. See attached code.

You must have some different release of NetBSD than any I have. I get "0 0" from your program on stock 4.0, a netbsd-4 branch ("4.0_STABLE") system,
and of course on 1.6.2 too.  Same on Mac OS X 10.5.2 as well.

Grmbl. So I picked one of the few locales that were added after NetBSD
4. Other sample.

Yes, I know what you were getting at, but the question really is what do you make of the result of this change to your example? I.e. adding the cast in the call as was suggested in the first place? Besides, what does it really matter? The result of islower(EOF) is undefined anyway!

#include <ctype.h>
#include <locale.h>
#include <stdio.h>

int
main(void)
{
        setlocale(LC_ALL, "en_US.ISO8859-1");

        printf("%d %d\n", islower(-1), islower(255));
printf("%d %d\n", islower((unsigned char)-1), islower((unsigned char)255));
        return 0;
}

--
                                        Greg A. Woods; Planix, Inc.
                                        <woods%planix.ca@localhost>



Home | Main Index | Thread Index | Old Index