* Jonathan S. Shapiro: > I have been looking at SQLite lately, which is written in C. It implements > an unusual design pattern. The purpose of this pattern is to allow the > library to allocate structures of unknown concrete type (therefore unknown > size) on the stack.
Ada has the same problem (for arrays and class-wide types). Some time ago, GNAT on MIPS supported a special ABI where an allocating function could return with an elevated stack pointer. I don't think this was ever extended to other architectures, and with Ada 2005, this doesn't work in general, so GNAT passes a malloc implementation as a closure. This way, the caller can choose between allocation on the secondary stack (which is returned elevated, but doesn't contain return addresses), the default global storage pool, or some other user-defined storage pool. _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
