[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PATH_MAX and test-stat.h
From: |
Ralf Wildenhues |
Subject: |
Re: PATH_MAX and test-stat.h |
Date: |
Mon, 20 Jun 2011 08:28:22 +0200 |
* James Youngman wrote on Sun, Jun 19, 2011 at 11:17:22PM CEST:
> On Sun, Jun 19, 2011 at 7:49 AM, Ralf Wildenhues wrote:
> > * James Youngman wrote on Sun, Jun 19, 2011 at 12:57:01AM CEST:
> >> On Sat, Jun 18, 2011 at 11:24 PM, Karl Berry <address@hidden> wrote:
> >> > I suspect that the most useful thing we can do in gnulib is define
> >> > PATH_MAX to a non-constant expression on all platforms,
> >> >
> >> > And intentionally break loads of existing code?
> >> > I am highly doubtful that that is "useful"; "painful" sounds more
> >> > accurate :).
> >>
> >> I much prefer obvious breakage, in which problem code simply fails to
> >> compile, to subtle breakage where your code compiles on all the
> >> systems you have access to but still has subtle problems.
> >
> > Is it possible to define it to an expression which will cause a warning
> > if used in a way requiring it to be a constant expression?
>
> ISO C requires an array bounds expression to be a constant-expression
> (in the circumstances, not a surprise) but many implementations don't
> produce a warning when some other kind of expression is used.
Yes, but that's not quite what I asked for. I'm trying to get the
best of both worlds: have
char cwd[PATH_MAX];
use VLAs with GCC on decent systems, but also let it warn that it's not
portable code.
Cheers,
Ralf
Re: PATH_MAX and test-stat.h, Eric Blake, 2011/06/20
[PATCH] test-stat: don't allocate PATH_MAX bytes, Eric Blake, 2011/06/20