[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/34516: size_t should be equivalent to unsigned long
The following reply was made to PR lib/34516; it has been noted by GNATS.
From: David Holland <dholland%eecs.harvard.edu@localhost>
Subject: Re: lib/34516: size_t should be equivalent to unsigned long
Date: Sat, 19 Jan 2008 21:57:34 -0500
> At least on i386, size_t is an alias for unsigned int. In practice,
> unsigned long and size_t are essentially the same types on all
> platforms I know of despite being treated as different types by
> C compilers if defined as such.
size_t is not, however, the *same* as unsigned long. Code that
indiscriminately mixes size_t with unsigned long_t is no better than
code that indiscriminately mixes size_t with unsigned int; it is not
portable. It is not clear to me that there is any particular merit to
associated with picking one way over the other. C does not support
newtypes, so there is no way to avoid masking some such set of coding
Furthermore, the precise expansion of size_t is gcc's choice, because
gcc "knows" the type signatures of various standard functions, so we
can't or shouldn't change it in NetBSD even if there were a good
argument in favor.
- David A. Holland / dholland%eecs.harvard.edu@localhost
Main Index |
Thread Index |