Is there any real reason to use "const"?

rempas rempas at tutanota.com
Thu Jan 27 06:28:41 UTC 2022


On Thursday, 27 January 2022 at 06:26:43 UTC, rempas wrote:
> On Tuesday, 25 January 2022 at 10:42:35 UTC, bauss wrote:
>> Sure thing but that's not realistic if you work professionally 
>> as you might be handed code that 15 other people worked on for 
>> a decade before you.
>>
>> You will not be able to reason about the memory properly, in 
>> which case if certain variables are marked with const it will 
>> tell future people that this is read-only memory.
>
> When saying "we would try to avoid working with read-only 
> memory and pointers directly", I mean the language I'm going to 
> create. So yeah, there will be no code from 10 years ago, I'm 
> pretty sure ;)
>
> Aside from the joke, I will keep the fact the a lot of people 
> will work in the same project so having as many protections as 
> possible.

Yep! I answered two times in the same reply! You will only see 
that from me! The one and only!


More information about the Digitalmars-d mailing list