3 ms·
Referring to stack allocation as "static allocation" is just not something I've seen before. I suspect you're simply in error; maybe you misheard someone sayin
by kragen 7y ago
Referring to stack allocation as "static allocation" is just not something I've seen before. I suspect you're simply in error; maybe you misheard someone saying the phrase "stack allocation", or you've been talking to somebody who misheard it that way. You can statically allocate a local variable in C, for example:
static char *err = NULL;
But that specifically does not allocate it on the stack. Both heap allocation and stack allocation are dynamic, not static.
There are things that are a bit more of a gray area in C and Unix and Win32/64 — are "statically allocated" variables of a shared library really statically allocated if they aren't there when the program starts up and they may be at some unexpected address? — but this is not one of them.