[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'static' in array-size func parm
From: |
Paul Eggert |
Subject: |
Re: 'static' in array-size func parm |
Date: |
Thu, 07 Aug 2014 17:44:00 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
In looking into this I realized a couple of things. First, I partially
addressed this problem in 2006 in gnulib's AC_C_VARARRAYS macro (sorry,
I forgot about this until today). Second, the C standardization
committee addressed it in a different way, in C11's __STDC_NO_VLA__
macro. So just now I fixed gnulib to do things the C11 way. RCS should
be able to use the vararrays module of the updated gnulib, and then do
something like this:
/* A function's argument must point to an array with at least N
elements.
Example: 'int main (int argc, char *argv[VLA_ELEMS (argc)]);'. */
#ifdef __STDC_NO_VLA__
# define VLA_ELEMS(n)
#else
# define VLA_ELEMS(n) static n
#endif
I prefer the name VLA_ELEMS to ARSZ_FN_PARM, as it's shorter and more
mnemonic to people who are used to the standard terminology.
It might be helpful to have a gnulib module that implements VLA_ELEMS,
such as in the attached patch; what do you think? (I haven't installed it.)
0001-vla-new-module.patch
Description: Text document
- 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/06
- Re: 'static' in array-size func parm, Paul Eggert, 2014/08/06
- Re: 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/06
- Re: 'static' in array-size func parm, Paul Eggert, 2014/08/06
- Re: 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/06
- Re: 'static' in array-size func parm,
Paul Eggert <=
- Re: 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/08
- Re: 'static' in array-size func parm, Paul Eggert, 2014/08/08
- Re: 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/08
- Re: 'static' in array-size func parm, Paul Eggert, 2014/08/08
- Re: 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/08
- Re: 'static' in array-size func parm, Paul Eggert, 2014/08/09
- Re: 'static' in array-size func parm, Thien-Thi Nguyen, 2014/08/09