Dynamic array head const in library code?
    Dominikus Dittes Scherkl via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Fri Nov 28 04:18:22 PST 2014
    
    
  
On Friday, 28 November 2014 at 10:55:27 UTC, bearophile wrote:
> In D code it's a good idea to set as const/immutable (where 
> possible) all variables that don't need to change, for both 
> safety and compiler-enforced code documentation.
> In my D functions sometimes I create dynamic arrays that later 
> don't have to change length nor to be reassigned, but I have to 
> mutate or assign their items.
Why you don't use static arrays for such a purpose?
I thought this is exactly what they are made for, aren't they?
    
    
More information about the Digitalmars-d-learn
mailing list