assert semantic change proposal

Tove via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 3 19:26:44 PDT 2014


On Monday, 4 August 2014 at 01:26:10 UTC, Daniel Gibson wrote:
> Am 04.08.2014 03:17, schrieb John Carter:
>> But that's OK.
>>
>> Because I bet 99.999% of those warnings will be pointing 
>> straight at
>> bone fide defects.
>>
>
> Well, that would make the problem more acceptable..
> However, it has been argued that it's very hard to warn about 
> code that will be eliminated, because that code often only 
> become dead or redundant due to inlining, template 
> instantiation, mixin, ... and you can't warn in those cases.
> So I doubt that the compiler will warn every time it removes 
> checks that are considered superfluous because of a preceding 
> assert().
>
> Cheers,
> Daniel

It is possible, just not as a default enabled warning.

Some compilers offers optimization diagnostics which can be 
enabled by a switch, I'm quite fond of those as it's a much 
faster way to go through a list of compiler highlighted 
failed/successful optimizations rather than being forced to check 
the asm output after every new compiler version or minor code 
refactoring.

In my experience, it actually works fine in huge projects, even 
if there are false positives you can analyse what changes from 
the previous version as well as ignoring modules which you know 
is not performance critical.


More information about the Digitalmars-d mailing list