Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - alloca : (1 Item)
   
alloca  
Hello,

Current definition of alloca creates problems in code like this:

   char *str = strcpy (alloca (strlen (command_str) + 1), 
command_str);

Compiler generates error:

  error: null argument where non-null required (argument 1)


Why did we define alloca the way we did?

If there is no particular reason, then would something like 
this patch (attached) make sense?

(Disclaimer: this is not patch submission, but rather an 
illustration - I don't know what would be the right way to 
specify always_inline attribute or inline modifier to make 
all supported compilers happy).



Thanks,


Aleksandar
Attachment: Text alloca.h.patch 1.21 KB