Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
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