Subject: Re: ctype "(int)" casting (Re: pkg_select upgrade)
To: Jachym Holecek <email@example.com>
From: Martin S. Weber <Ephaeton@gmx.net>
Date: 03/17/2005 08:51:14
On Thu, Mar 17, 2005 at 08:23:18AM +0100, Jachym Holecek wrote:
> > (...)
> > Is relying on C to make
> > char c = <whatever>, tolower(c)
> > work w/o complaint a user error ?
> This has been brought up in the past, see:
Ah, so it was in there, and has been removed.
(quoting from there)
> ( ... ) More, according to the ISO C standard,
> they are required to be functions--it is legal to declare and call,
> e.g., isprint(), without including <ctype.h>. The system may provide
> macro definitions in <ctype.h> for speed, and is required to provide
> function definitions for use without including <ctype.h>
So basically is* shouldn't complain when given a (signed) char, should it?
> The only safe and portable approach for the calling code is to never
> use plain (or signed) char to hold the value.
So it won't dtrt w/o being an unsigned. The function prototyped version
of is* wouldn't dtrt either, but not warn about it. So either have the
macro do the appropriate casts so it dtrt or just shut it up without
dtrt just like a function does. Imo the current state is not very
helpful (and given the function signature, the adept programmer will
take the wrong steps to solve the problem (i.e. add an (int) cast)).
(Personal impression porting software solaris -> NetBSD :
Software compiles flawlessly on some systems, on others it coughs out
a huge number of warnings someone uninformed might blame on the system.
How do you (you = who made/was for making is* & to* more 'chatty') advocate
this removal while (1) facing language standards and (2) in the light
of NetBSD getting all the blame?