bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19


From: Bruno Haible
Subject: Re: [Bug-gnulib] Re: gnulib/lib exclude.c,1.18,1.19
Date: Thu, 16 Oct 2003 15:36:48 +0200
User-agent: KMail/1.5

Jim Meyering wrote:
>   /* Caution: N_ALLOC and V must be L-values.  */
>   #define XNREALLOC (N_ALLOC, V, MULTIPLIER)                  \
>     do                                                                \
>       {                                                               \
>         V = xnrealloc (V, N_ALLOC, (MULTIPLIER) * sizeof *(V));       \
>         N_ALLOC *= MULTIPLIER;                                        \

Usually I use
          N_ALLOC = 2 * N_ALLOC + 1;
or
          N_ALLOC = 2 * N_ALLOC + 10;

because this allows me to initialize the array with NULL and its size with 0,
to optimize for the (not so unfrequent) case that the array will not be used
at all.

Therefore I'm not sure that your proposed macro with just

          N_ALLOC *= MULTIPLIER;

is universally useful.

Bruno





reply via email to

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