[EMAIL PROTECTED] (James Youngman) writes:

> Am I mistaken, or is it the case that the C99 standard allows size_t
> to be wider than unsigned long?

You are not mistaken.  However, for gnulib the GNU coding standards
trump that.  They say:

   ... don't make any effort to cater to the possibility that
   'long' will be smaller than predefined types like 'size_t'.
   For example, the following code is ok:

     printf ("size = %lu\n", (unsigned long) sizeof array);
     printf ("diff = %ld\n", (long) (pointer2 - pointer1));

   1989 Standard C requires this to work, and we know of only one
   counterexample: 64-bit programs on Microsoft Windows IA-64.  We will
   leave it to those who want to port GNU programs to that environment
   to figure out how to do it.

   Predefined file-size types like 'off_t' are an exception: they are
   longer than 'long' on many platforms, so code like the above won't
   work with them.  One way to print an 'off_t' value portably is to
   print its digits yourself, one by one.


POSIX 1003.1-2001 also requires support for the assumption that size_t
is no wider than long int (sorry, can't cite chapter and verse
offhand).


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to