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 09:58:50PM +0200, Jaromír Doleček wrote:
> Le jeu. 13 mai 2021 à 21:44, Joerg Sonnenberger <joerg%bec.de@localhost> a écrit :
> > > 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.
> 
> Allright.
> 
> Anyway, would it be wrong to add <alloca.h> which unconditionally
> makes alloca() use the builtin, similar to what e.g. glibc (Linux) and
> FreeBSD do, or is it fundamentally wrong doing so?

I don't see the point in it. The source is wrong to request strict C++14
compatibility and then use an extension. Just because Linux folks do
that wrong doesn't mean we should cater to their bugs.

Joerg


Home | Main Index | Thread Index | Old Index