Subject: Re: lib/19638: isalpha (3) bug
To: Mike Cheponis <mac@Wireless.Com>
From: Martin Husemann <martin@duskware.de>
List: netbsd-bugs
Date: 01/02/2003 22:02:30
On Thu, Jan 02, 2003 at 10:52:49AM -0800, Mike Cheponis wrote:

> Still, it seems a gross bug to take an "int" argument and then segfault
> when the routine sees an argument it doesn't like.

Well, passing sub-int sized types as arguments is only possible with proper
prototypes in scope - and this function predates prototypes.
Furthermore you need to be able to pass EOF, which might not fit into a "char"
(everything that getc might return).

So the "physical" datatype passed has a wider domain than the logical expected
parameter - and there is no good way to express this in C. For performance
reasons no argument checks are done inside the function - you need to do them
beforehand yourself, if you care. That's C.

Read the standard chapter about it. Think about it. Realy, it is no bug.

> It's not the "NetBSD Way".

It's the same on most other implementations I ever worked with. It's documented,
expected behaviour.

Martin