runtime static arrays

bearophile bearophileHUGS at lycos.com
Tue Nov 20 19:19:59 PST 2012


Jonathan M Davis:

> One serious problem posed by them is that the size then can't 
> be part of the
> type, meaning that you can't possibly pass them around. If you 
> did, you'd just
> be passing dynamic arrays around.

Take a look at my code, few posts above. When a VLA is passed to 
a function, it "decays" to a dynamic array.


> You'd have the same problem with them with
> templates - everything instantiated with them would have to be 
> instantiated as
> a dynamic array, which could cause problems.

Templates will support arrays, they already do partially.

Kind of arrays and templates are two orthogonal things. What 
matters for templates is the a value is known at compile time or 
not. So I think this is not a problem.


> there are definitely problems with
> doing that once you start getting into the details of what that 
> would mean.

I agree there are some problems. But I think they aren't hard 
problems to solve.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list