Is there any real reason to use "const"?
rempas
rempas at tutanota.com
Tue Jan 25 08:41:08 UTC 2022
On Monday, 24 January 2022 at 20:26:03 UTC, Patrick Schluter
wrote:
> No, at API level it is also a documentation help. When a
> parameter is marked as const, the code reader can be sure that
> there are no side effects in that function on that parameter.
> This reduces the mental burden when one tries to read code.
We could also had a library reference documentation that explains
that in the worse case. But yeah, "const" works better for this
More information about the Digitalmars-d
mailing list