Is there any real reason to use "const"?

Walter Bright newshound2 at
Mon Jan 24 21:21:50 UTC 2022

On 1/24/2022 11:09 AM, Steven Schveighoffer wrote:
> Sure, but const isn't necessary for that. Const is a compiler construct to 
> prevent you from doing stupid things. But a programming language can run 
> perfectly fine with ROM without having a const concept.
> D1 put string literals in ROM without const.

Yeah, but it's undefined behavior if you write to them.

More information about the Digitalmars-d mailing list