make-w32
[Top][All Lists]
Advanced

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

Re: Make CVS HEAD version build out of the box


From: Eli Zaretskii
Subject: Re: Make CVS HEAD version build out of the box
Date: Wed, 03 Oct 2007 14:26:46 +0200

> Date: Wed, 3 Oct 2007 19:26:29 +0800
> From: "Yongwei Wu" <address@hidden>
> Cc: address@hidden, address@hidden
> 
> On 03/10/2007, Eli Zaretskii <address@hidden> wrote:
> > > From: Paul Smith <address@hidden>
> > > Cc: Yongwei Wu <address@hidden>, address@hidden
> > > Date: Tue, 02 Oct 2007 21:39:04 -0400
> > >
> > > On Tue, 2007-10-02 at 17:26 +0200, Eli Zaretskii wrote:
> > > > What advantage is there in using alloca?
> > >
> > > So, alloca() is nice because it's dynamic.
> >
> > But it could get you in trouble if the file name in question is very
> > long, since the stack is limited.
> 
> char array[MAX] also allocates on the stack.

Of course.  But it allocates a constant-size buffer, and the value is
sufficiently small to avoid any problems (except if Make is already
terribly short on free stack space, which shouldn't happen).

By contrast, using alloca with very long file names is less safe.  In
general, using alloca for more than a few KB is not recommended.

> So alloca is better, since it should allocate less.

It should allocate less only for file names shorter than MAXPATHLEN.
But I was responding to what Paul wrote: that on many modern
filesystems file names can be longer than that.  In particular, I've
seen situations on Windows where various APIs return file names longer
than 260 characters, which other APIs cannot handle.




reply via email to

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