tech-userlevel archive

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

Re: Adding <alloca.h> ?



On Thu, May 13, 2021 at 12:51:45PM +0200, Jaromír Doleček wrote:
> Le jeu. 13 mai 2021 à 01:04, Joerg Sonnenberger <joerg%bec.de@localhost> a écrit :
> >
> > On Wed, May 12, 2021 at 08:32:20PM +0200, Jaromír Doleček wrote:
> > > Le mer. 12 mai 2021 à 13:50, Joerg Sonnenberger <joerg%bec.de@localhost> a écrit :
> > > >
> > > > On Wed, May 12, 2021 at 08:38:39AM +0200, Jaromír Doleček wrote:
> > > > > would it be a bad thing to add a compatibility <alloca.h> which would
> > > > > use the builtin alloca() instead of the libc one when available?
> > > > >
> > > > > e.g. MySQL 8.0.* seems to rely on this.
> > > >
> > > > We provide it in stdlib.h as long as a standard mode is not set.
> > > > I don't see the point of adding alloca.h.
> > >
> > > We don't provide the builtin in stdlib.h.
> >
> > Yes, we do.
> 
> No we don't, unless you are using PCC :D
> 
> The block in <stdlib.h> only provides an alloca(3) prototype, and only
> if the compiler already #defines alloca as __builtin_alloca.
> 
> While this works for gcc in some -std modes (e.g. gnu++14), it does
> not in others (c++14, c++11).

Your analysis is wrong. We don't provide a prototype in standard modes
as that violates the user request. The prototype is enough to trigger
the builtin logic in GCC and Clang.

Joerg


Home | Main Index | Thread Index | Old Index