[Top][All Lists]

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

Re: Recommended alloca declaration breaks on alloca.c

From: Hrvoje Niksic
Subject: Re: Recommended alloca declaration breaks on alloca.c
Date: Mon, 11 Apr 2005 01:55:15 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

address@hidden (James Youngman) writes:

> On Sun, Apr 10, 2005 at 02:02:20PM +0200, Hrvoje Niksic wrote:
>> It turns out that the alloca declaration that the Autoconf manual[1]
>> recommends for config.h declares alloca() as returning char *, whereas
>> the C implementation I use declares it as returning void *.  But
>> regardless of alloca.c, another problem is that, on Linux, stdlib.h
>> includes alloca.h, which also declares void *alloca().
>> I fixed this problem by changing the declaration from "char
>> *alloca();" to "void *alloca();".  Is there a better fix, or should
>> the manual be updated for alloca to return void *?
> If the GNU C library implements alloca() itself, then it should be
> declared in /usr/include/alloca.h.

The library cannot correctly implement alloca, it has to be supported
by the compiler.  In fact, I'm not sure why glibc includes alloca.h
and declares alloca as if it were an external function.

But regardless of that, the (previously) recommended config.h alloca
prototype differs from its actual definition in alloca.c, and that's a
bug irrespective of existence and contents of /usr/include/alloca.h.

reply via email to

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