const int vs. int const

Francesco Cattoglio via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 17 12:32:06 PDT 2014


On Saturday, 16 August 2014 at 21:42:59 UTC, Jonathan M Davis 
wrote:
> On Saturday, 16 August 2014 at 18:50:08 UTC, Jacob Carlborg 
> wrote:
>> On 2014-08-16 01:33, Mike wrote:
>>
>>> Sounds like a worthwhile impromement to me.
>>
>> Sounds like a breaking change to me. Which will include the 
>> usual complains.
>
> Yes, but it's either that or have people running into this
> problem and complaining about it and the bugs that it causes for
> years to come. And it's _already_ bad practice to put const,
> immutable, inout, or shared on the left-hand side without 
> parens,
> and pretty much everyone has run into the problem at one time or
> another when trying to return const from a function and would
> know to avoid putting those atributes on the left. So, the vast
> majority of code wouldn't be affected. And of course, we'd do it
> via deprecation, so it wouldn't immediately break code.

For what it is worth, I can confirm this bit me and a coworker of 
mine.
Deprecation of this makes sense. IIRC there's a bunch of C valid 
code that are rejected by dmd because the semantic is different. 
This seems to be one of those cases.


More information about the Digitalmars-d mailing list