the best language I have ever met(?)

Igor Shirkalin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 23 10:54:35 PST 2016


On Tuesday, 22 November 2016 at 00:08:05 UTC, ketmar wrote:
> On Monday, 21 November 2016 at 23:49:27 UTC, burjui wrote:
>> Though I would argue that it's better to use '_' instead of 
>> '$' to denote deduced fixed size, it seems more obvious to me:
>>
>> int[_] array = [ 1, 2, 3 ];
>
> alas, `_` is valid identifier, so `enum _ = 42; int[_] a;` is 
> perfectly valid. dollar is simply most logical non-identifier 
> character.

We can define static array without counting the elements as 
following:


enum array_ = [1u,2,3,4];
uint[array_.length] static_array = array_;


More information about the Digitalmars-d-learn mailing list