T[new] misgivings

Don nospam at nospam.com
Fri Oct 16 07:39:38 PDT 2009


Andrei Alexandrescu wrote:
> Don wrote:
>> In case this isn't clear:
>>
>> real [] sinsTable = [ sin(1.0), sin(2.0), sin(3.0), sin(4.0) ];
>>
>> How do you do this so that the entries in the table are calculated at 
>> compile time?
> 
> static?
> 
> Andrei

That's still not compile time. They're initialized in the module 
constructor.
If you make them an enum array, they're at compile time, but then you 
shouldn't be able to index the array at runtime (the whole point of 
'enum' was that it doesn't get stored).



More information about the Digitalmars-d mailing list