[PATCH] Avoid using the PATH_MAX constant, which may be undefined.

Thomas Schwinge thomas at codesourcery.com
Mon Mar 25 16:02:14 PDT 2013


Hi!

On Mon, 25 Mar 2013 10:56:40 -0700, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> The OS X manpage says it supports allocating memory too. Do you know
> of any supported system that requires the caller to pass in the
> buffer?

> > +# ifdef __GLIBC__  // POSIX.1-2008 in fact.
> > +  // Avoid using the PATH_MAX constant, which may be undefined.
> > +  char *CanonicalNameBuf = realpath(Dir->getName(), NULL);

As indicated there, this behavior when passing NULL as its second
argument is specified by POSIX.1-2008 (and was specified as
implementation-defined before, in POSIX.1-2001).  I don't know the
LLVM/clang conventions good enough to judge whether we can generally rely
on the 2008 behavior?  (I think I would be a bit reluctant to.)


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130326/15b8f43e/attachment.sig>


More information about the cfe-commits mailing list