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 16-Apr-08, at 6:30 PM, Christos Zoulas wrote:
- cast ctype arguments to unsigned char and not int, otherwise you silence
the warning but you can still get a core-dump.


If you're talking about the is*() and to*() APIs from libc then that doesn't seem to make any sense for a standards compatible program.

The definitions in all of the standards, an in the NetBSD manual pages, all request that the parameters for these functions are to be passed as (int).

Unfortunately even various NetBSD architectures, at least for some releases, are inconsistent in how these interfaces are defined and what warnings are given for various usages. I've had the best luck getting the least warnings on a wide variety of platforms by always casting to (int) too.

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





Home | Main Index | Thread Index | Old Index