bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIZE_MAX


From: Bruno Haible
Subject: Re: SIZE_MAX
Date: Tue, 6 Oct 2009 23:48:37 +0200
User-agent: KMail/1.9.9

Simon Josefsson wrote:
> > I suppose these should include stdint.h also?
> >
> > areadlink.c:# define SIZE_MAX ((size_t) -1)
> > areadlink-with-size.c:# define SIZE_MAX ((size_t) -1)
> > backupfile.c:# define SIZE_MAX ((size_t) -1)
> > fnmatch.c:# define SIZE_MAX ((size_t) -1)
> > quotearg.c:# define SIZE_MAX ((size_t) -1)
> > striconv.c:# define SIZE_MAX ((size_t) -1)
> 
> Note that stdint.h may not be sufficient to get SIZE_MAX, quoting
> size_max.h:
> 
> /* Get SIZE_MAX declaration on systems like Solaris 7/8/9.  */
> # include <limits.h>
> /* Get SIZE_MAX declaration on systems like glibc 2.  */
> # if HAVE_STDINT_H
> #  include <stdint.h>
> # endif
> /* On systems where these include files don't define it, SIZE_MAX is defined
>    in config.h.  */
> 
> However given that SIZE_MAX should be in stdint.h according to POSIX

POSIX says <stdint.h> must define SIZE_MAX, and the gnulib 'stdint' module
does it. It's only when the gnulib 'stdint' module is *not* in use that
you have to use the size_max.h file.

> maybe it makes more sense to make sure gnulib's stdint.h replacement is
> enabled when SIZE_MAX is not provided by the system's stdint.h?

m4/stdint.m4 does exactly this.

> And then deprecate size_max.h in favor of stdint.

We talked about it in this thread:
  <http://lists.gnu.org/archive/html/bug-gnulib/2009-05/msg00193.html>
I explained why the size_max module is needed. But I have no problems with
discouraging its use:


2009-10-06  Bruno Haible  <address@hidden>

        * modules/size_max (Description): Discourage its use.
        Reported by Simon Josefsson.

--- modules/size_max.orig       2009-10-06 23:47:04.000000000 +0200
+++ modules/size_max    2009-10-06 23:41:51.000000000 +0200
@@ -1,5 +1,5 @@
 Description:
-Provide SIZE_MAX.
+Provide SIZE_MAX, for cases when the 'stdint' module cannot be used.
 
 Files:
 m4/size_max.m4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]