Should I prefer immutable or const?

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 1 10:52:56 PDT 2016


Should I always, when possible, prefer `immutable` over `const`?

And does `immutable` increase the possibility of the compiler 
doing optimizations, such as common subexpression elimination?

Or can the compiler infer `const` declarations to also be 
`immutable`?


More information about the Digitalmars-d-learn mailing list