[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: size_max
From: |
Paul Eggert |
Subject: |
Re: size_max |
Date: |
Fri, 24 Jun 2005 14:23:36 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux) |
Simon Josefsson <address@hidden> writes:
> What is the criteria for being listed as maintainer of a gnulib
> module? Wrote the code? Interested in supporting the code?
> Modularized the code? Wrote the module file? Gnulib developer?
Yes to all the above. :-)
The criteria aren't formal, but basically it's the person who makes
sure that the code is fixed and/or improved when needed.
> In this case, I think naming me and Bruno as maintainer would be the
> right thing. Ok?
It's fine with me, though I'd like to hear Bruno's opinion.
> Should we start replacing
>
> /* Get SIZE_MAX. */
> #include <limits.h>
> #if HAVE_STDINT_H
> # include <stdint.h>
> #endif
>
> and/or
>
> #ifndef SIZE_MAX
> # define SIZE_MAX ((size_t) -1)
> #endif
>
> with
>
> /* Get SIZE_MAX. */
> #include "size_max.h"
I don't see a need for it, no. (size_t) -1 works just fine, unless
you need SIZE_MAX in #if lines.
Also, there's no point to that last "/* Get SIZE_MAX. */" comment.
(That comment is almost as redundant the one in "a++; /* Add 1 to a. */". :-)
> Is SIZE_MAX guaranteed to be ((size_t)-1)?
Yes. That's true in both C89 and C99. For every unsigned type T,
((T) -1) is guaranteed to be T's maximal value.
> Should size_max.h, as a safety precaution, read:
> ...
> # ifndef SIZE_MAX
> # define SIZE_MAX ((size_t) -1)
> # endif
No, because the main point of size_max.h (from my point of view,
anyway) is to define a SIZE_MAX value that can be used in #if lines.
Come to think of it, if your uses of SIZE_MAX are not in #if lines,
why don't you just write
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
after all your system includes? That is, do you really need a
size_max module? It seems like a lot of work to reduce three
easily-understood lines to one.