4 ms·
> Not all platforms have Sufficiently Smart Compilers; I've got code relying on SDCC and TCC, for instance. :) I'm pretty sure that it's not a matter of compi
by jcelerier 9y ago
> Not all platforms have Sufficiently Smart Compilers; I've got code relying on SDCC and TCC, for instance. :)
I'm pretty sure that it's not a matter of compiler brightness; the C and C++ standards are both pretty explicit about when the automatic and dynamic storages are used. If anything, I guess that it would be harder for compilers to allocate such things on the heap.
I checked and tcc doesn't allocate anything for instance for this code; neither does gcc 4.4 in c++98 mode :
int main()
{
struct foo {
int a, b, c;
char x[3000];
} f;
}
- dleslie 9y agoYou're basically confirming my supposition that I'll need to spend time reviewing the new C++ standards. ;)