why array do not support gcc style Initialize way?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Sep 11 20:52:09 UTC 2019


On Wed, Sep 11, 2019 at 08:36:03PM +0000, Roberto Rosmaninho via Digitalmars-d wrote:
[...]
> enum Color { red, blue, green };
> 
> int[Color.max + 1] value =
>   [ Color.blue :6,
>     Color.green:2,
>     Color.red  :5 ];
> 
> Produces the output “onlineapp.d(4): Deprecation: use `{ }` for an empty
> statement, not `;`” when I executed it.
> 
> Any clues of why it’s happened?

Delete the ';' from the end of your 'enum' declaration. In D, enum
declarations do not need to be terminated with ';' (you cannot declare
enum variables with it, unlike C).


T

-- 
INTEL = Only half of "intelligence".


More information about the Digitalmars-d mailing list