This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: alloca and c++
- From: Ingo Krabbe <i dot krabbe at dokom dot net>
- To: Devang Patel <dpatel at apple dot com>,Gabriel Dos Reis <gdr at codesourcery dot com>
- Cc: Devang Patel <dpatel at apple dot com>,gcc at gcc dot gnu dot org
- Date: Sat, 2 Feb 2002 00:08:21 +0100
- Subject: Re: alloca and c++
- Organization: ask (automatische system komponenten)
- References: <CB69DD33-1751-11D6-9970-00039310EDEA@apple.com> <E16WmYa-0001pi-00@mail.dokom.net>
Further analysis revealed that usage of -ansi forces that error:
g++ -ansi main.cc --> error
g++ -ansi -D_GNU_SOURCE main.cc --> ok
I need also to include stdlib.h as extern "C" to get the right symbols
working.
#include <features.h>
extern "C" {
#include <stdlib.h>
extern void* alloca( size_t );
}
extern int main( int, char** );
int main( int argc, char** argv )
{
void* x = alloca( 100 );
return 0;
}