const in functions

FozzieBear FozzieBear at gmail.com
Sun Mar 12 23:14:08 UTC 2023


On Sunday, 12 March 2023 at 15:09:45 UTC, Salih Dincer wrote:
>
> ...

So I don't agree with part of this comment (made elsewhere in 
this thread):

"You can live without 'const' until your code interacts with 
other people's code."

Code interacts with other code. Code should always be clear as to 
its intent. Who wrote that code, or other code that interacts 
with that code, is irrelvant.

As for the issue of 'const' itelf, I refer you to a thoughtful 
article on this matter:

(I'm not saying I agree with this article, or that I don't agree, 
I'm just referring it to you to make your own judgements.

http://www.jmdavisprog.com/articles/why-const-sucks.html



More information about the Digitalmars-d-learn mailing list