Re: sizeof() calculated at compile time or run time
On Sep 14, 11:48 pm, "Default User" <defaultuse...@yahoo.com> wrote:
Alf P. Steinbach wrote:
[...]
I suspect that if VLAs ever do make it into C++, they will look a lot
like C99. Your opinion may vary.
Probably, since the only motivation ever expressed (at least
before the committee) for adding them to C++ was C
compatibility. Since class/struct have somewhat different
semantics in C++ than in C, it would take some adapting to make
them fit into the C++ model. And since no one felt that they
added enough value to be worth the work, C++ didn't adopt them.
[alloca]
Do they support that specifically for C++, or is it a
holdover from C extensions?
Neither. It's for both languages. See e.g.
http://docs.sun.com/app/docs/doc/819-2243/alloca-3c.
That tells you what it is, not why it's available in C++. It
suspect that it was created for C, and used in C++
pre-STL/std. I think it's more a holdover than something they
feel is specifically needed for C++ (if they even think about
it much).
It's very much a hold-over, a hack from Berkley Unix, still
maintained in order to avoid breaking (very) old code. It's not
normally used in modern C, either. (On the other hand, I can
very well imagine that some code C++ written back in the 1980's
used it.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34