This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alloca and c++


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;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]