Is there any real reason to use "const"?

Walter Bright newshound2 at digitalmars.com
Mon Jan 24 15:40:56 UTC 2022


On 1/24/2022 2:06 AM, rempas wrote:
> Also another problem is that I don't like the way "const" is treated in 
> functions. For example, you cannot past "const" variables to functions that take 
> non-const parameters even if we are using variables which are ALWAYS copied 

Not sure what you mean. This compiles:

   int foo(const int);

   int bar(int i)
   {
     return foo(i);
   }


More information about the Digitalmars-d mailing list