Subject: Re: ctype "(int)" casting (Re: pkg_select upgrade)
To: Martin Husemann <>
From: Martin S. Weber <>
List: tech-userlevel
Date: 03/17/2005 09:47:45
On Thu, Mar 17, 2005 at 09:03:27AM +0100, Martin Husemann wrote:
> On Thu, Mar 17, 2005 at 08:51:14AM +0100, Martin S. Weber wrote:
> >   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?
> It is good to catch as much errors as possible automatically.


> This is the same as libpthread shooting applications that do the
> wrong thing. We've been through a lot of pain and NetBSD got quite
> some blame for it, but it caught real bugs all over the place in 
> applications that were said to be running flawlessly (which of course is
> a myth) on other OSes.

I don't think it's the same.

I think you misunderstood me, or I'm misunderstanding the situation with
libpthread. As I take it, libpthread is standard compliant, while the programs
with the bugs were tweaked away from the standards so they would run with
other, existing thread libraries. libpthread isn't that sloppy either.

That's fine, as a runtime issue, and having draconic checks that what you're
operating on is actually what you should be operating on is fine either. In
other words, you're enforcing the standard. Great!

But this is a compile time issue, and as it stands you cannot compile a
standard compliant iso c program under NetBSD with -Werror[1], because it
will fail in a place where it must not fail. "C" says, "promote and shut
up" while "NetBSD" says, "ugh, make sure you know what you're doing. We
don't give you a hint what's wrong, but you probably want ''something
different'' than a char here.". 

This is fine from a "dtrt" point of view, but it's another aspect of what
libpthread is doing. We're plainly not sticking to the standard, while
libpthread enforces it. A (non--Werror-stopping) warning that one probably
will want to use unsigned instead of (signed) chars would be great ...

I hope either the misunderstand is on my side, and to be removed soon, or
I got my message through.



[1]: -Wall -W -Werror -std=iso9899:1999