This is strictly of historical interest, but SOM, IBM's stillborn
competitor to Microsoft COM and a foundational component in the
ill-fated OpenDoc, included among its many complexities stack
allocation of objects. It worked[1] basically the way the post
describes: discover the class size (somGetInstanceSize), alloca() that
much memory, then pass it to "placement new" (somRenewNoInitNoZero).
It would be interesting to know if modern OO systems that manage memory
and attempt ABI compatibility (e.g. Swift) also work this way.
[1] Hamilton, "Programming with Direct-to-SOM C++", chapter 6;
https://archive.org/details/ProgrammingWithDirectToSOMC/page/n145
--
Cheers,
Alex
Interesting! Thanks, Alexander! While I'm not surprised this sort of thing
didn't take off, it's interesting to see that it was actually used in a
real system long ago.