Is there any real reason to use "const"?

bauss jj_1337 at live.dk
Tue Jan 25 13:31:43 UTC 2022


On Tuesday, 25 January 2022 at 11:40:18 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.
>
> Yeah, the problem with me is that I almost thing about the most 
> cases when you work alone or with good people but never cases 
> like the one you described. The others did an amazing job 
> explain that to me. That and the fact that humans do mistakes 
> even when they know what they are doing...

Yeah but it's not the norm, especially not for big companies 
where many people come and go all the time.


More information about the Digitalmars-d mailing list