WTF: dmd 2.066 vs. dmd 2.067 really dangerous code breakage

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 23 06:02:27 PDT 2015


On 4/23/15 6:14 AM, Kagamin wrote:
> On Wednesday, 22 April 2015 at 16:10:37 UTC, Steven Schveighoffer wrote:
>> You are misunderstanding what deprecation means then. The whole point
>> is "the semantics are going to change, please update your code, it's
>> coming soon". The -d is a way to get your code to compile now while
>> you update.
>
> So semantics can change just fine, a period of turning deprecation into
> an error is not needed at all?

Possibly this could have happened. Kind of too late now, though.

But the reason it probably did not happen, is that for code that makes 
no assumptions about whether immutable fields affect struct layout or 
not, there is no danger. Only if you do dangerous stuff like casting raw 
bytes to a struct with immutable fields will you have problems. The OP 
code is dangerous with or without this change.

As a general teaching moment, however, please don't ignore deprecation 
messages. They aren't just for laughs.

And all is not lost! Just compile with 2.066 without -d switch and fix 
all your errors with initialized immutables.

-Steve


More information about the Digitalmars-d mailing list