[Top][All Lists]

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

Re: PATH_MAX with mingw

From: Jim Meyering
Subject: Re: PATH_MAX with mingw
Date: Sat, 25 Aug 2007 18:18:29 +0200

Sylvain Beucler <address@hidden> wrote:
> I'm working on a program that works both under Unix and Woe.
> I see that under Woe, MAX_PATH is the equivalent for PATH_MAX, and is
> set to 260 in MinGW's headers (windef.h).
> Would it be interesting to check for MAX_PATH in pathmax.h, instead of
> defaulting to 256?

Hi Sylvain,

Thanks for letting us know.

For starters, in code intended to be portable, it's best not
to rely on PATH_MAX, if at all possible.  At a bare minimum,
don't use it as an array size, and don't try to allocate
PATH_MAX bytes from the heap.  On some systems, PATH_MAX
can be very large.  On the Hurd, it's not defined at all.

As for adjusting the code to let mingw applications use
four more bytes, it sounds like it wouldn't hurt, but isn't
there a definition of PATH_MAX in <limits.h>?
It looks like there used to be, at least.

reply via email to

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