:: Re: [DNG] [OT] [Re: Studying C as t…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: KatolaZ
Ημερομηνία:  
Προς: dng
Αντικείμενο: Re: [DNG] [OT] [Re: Studying C as told. (For help)
On Tue, Jun 21, 2016 at 09:57:06PM +0200, Adam Borowski wrote:
> On Tue, Jun 21, 2016 at 05:55:52PM +0100, KatolaZ wrote:
> > On Tue, Jun 21, 2016 at 06:41:15PM +0200, Edward Bartolo wrote:
> > > And
> > > << if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) >>
> > >
> > > would reduce to:
> > >
> > > if (isletter(c))
> >
> > or, you could just use "isalpha(c)", as suggested also by Urban.
>
> Bad idea, it's non-portable. I don't know about isalpha() in particular,
> but quite recently I met a hard to debug bug on Solaris on isspace(). Its
> implementation returns bogus values for bytes with the high bit set, not
> even the same on every call for the same input.
>


Uh? isalpha() not portable? Its behaviour was defined by ANSI C89, as
well as that of isspace(), isupper(), and a few more functions in
ctype.h. Maybe you hit a specific bug of a specific implementation,
but if you can't even use the functions defined in ANSI C, you'd
better program in assembly :)

HND

KatolaZ

-- 
[ ~.,_  Enzo Nicosia aka KatolaZ - GLUGCT -- Freaknet Medialab  ]  
[     "+.  katolaz [at] freaknet.org --- katolaz [at] yahoo.it  ]
[       @)   http://kalos.mine.nu ---  Devuan GNU + Linux User  ]
[     @@)  http://maths.qmul.ac.uk/~vnicosia --  GPG: 0B5F062F  ] 
[ (@@@)  Twitter: @KatolaZ - skype: katolaz -- github: KatolaZ  ]