Is there any real reason to use "const"?

Walter Bright newshound2 at
Mon Jan 24 15:44:54 UTC 2022

On 1/24/2022 6:40 AM, Steven Schveighoffer wrote:
> immutable/const is purely a compile-time concept. It's not reflected in the 
> final binary, so it's not necessary to forward the attributes to a language that 
> doesn't support it.

Immutable global data gets placed in read-only memory sections. Read-only memory 
sections are nice in a demand-paged virtual system, as the pages they are in 
never have to be copied because they are never marked as "dirty".

More information about the Digitalmars-d mailing list