const int vs. int const

John via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 15 10:18:02 PDT 2014


On Friday, 15 August 2014 at 17:05:55 UTC, John wrote:
> This may be a silly issue, but I recently read the better 
> practice is to begin with the variable type followed by const 
> keyword, but that order doesn't work in D. Is that intentional?
>
>   int const minWage = 11; //Error: no identifier for declarator 
> int
>   //const int minWage = 11; //works


btw, it works either way if I use auto

auto const minWage = 11; //works
const auto minWage = 11; //works

The same flexibility is missing when the actual type is used.


More information about the Digitalmars-d mailing list