[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PATH_MAX on the Hurd
From: |
Paul Eggert |
Subject: |
Re: PATH_MAX on the Hurd |
Date: |
Fri, 05 Aug 2011 16:19:51 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 |
On 08/05/2011 03:33 PM, Bruno Haible wrote:
>>> int a = PATH_MAX;
>> >
>> > Shouldn't this be:
>> >
>> > static int a[PATH_MAX];
> Maybe. Or possibly:
> enum { a = PATH_MAX };
>
> Are there cases when these three declarations don't all succeed and don't
> all fail?
Oh yes. :-)
"int a = PATH_MAX;" would allow a float PATH_MAX, which presumably
you'd rather reject. "static int a[PATH_MAX];" might warn you about
an array too large if PATH_MAX == SIZE_MAX; I'd make it "static char
a[PATH_MAX];". "enum { a = PATH_MAX };" won't work if PATH_MAX
exceeds INT_MAX, and also it doesn't check that PATH_MAX is positive;
these problems are both fixable, but since the intended use of
PATH_MAX is likely array sizes, the array's probably your best bet.
- Re: hurd builds, (continued)
- Re: hurd builds, Paul Eggert, 2011/08/03
- Re: PATH_MAX on the Hurd, Bruno Haible, 2011/08/03
- Re: PATH_MAX on the Hurd, Paul Eggert, 2011/08/03
- Re: PATH_MAX on the Hurd, Simon Josefsson, 2011/08/04
- Re: PATH_MAX on the Hurd, Bruno Haible, 2011/08/04
- Re: PATH_MAX on the Hurd, Bruno Haible, 2011/08/04
- Re: PATH_MAX on the Hurd, Eric Blake, 2011/08/05
- Re: PATH_MAX on the Hurd, Bruno Haible, 2011/08/05
- Re: PATH_MAX on the Hurd,
Paul Eggert <=
- Re: PATH_MAX on the Hurd, Eric Blake, 2011/08/05
- Re: PATH_MAX on the Hurd, Paul Eggert, 2011/08/05
- Re: PATH_MAX on the Hurd, Karl Berry, 2011/08/05