Zero-length static array spec

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 6 15:42:30 PST 2015


On Friday, 6 February 2015 at 23:37:30 UTC, Iain Buclaw wrote:
> Simple, you implement it by allocating no memory. :)

Let me put it a different way. Imagine you have this in your 
program:

---
void foo() {
   int[0] a0;
   int[0] a1;
   ...
   int[0] a99;

   // Do something with them.
}
---

How do you choose the addresses for a0 through a99 so that they 
are distinct, but you don't end up allocating 100 bytes of stack 
memory?

David


More information about the Digitalmars-d mailing list