assume, assert, enforce, @safe

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 09:36:01 PDT 2014


On Thu, Jul 31, 2014 at 03:44:35PM +0200, Daniel Gibson via Digitalmars-d wrote:
[...]
> And don't forget this (rather old) case:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8537
> (I really don't get why anyone would want such an optimization: I want
> an optimizer to use clever inlining, use SSE etc where it makes sense
> and stuff like that - but not to remove code I wrote.)
[...]

Modern compilers often have to deal with generated code (that isn't
directly written by the programmer, e.g., expanded from a C++ template
-- or, for that matter, generated by a code generator like lex / yacc).
In this case, you *do* want dead code removal because the code generator
may be written in a way that takes care of the general case, but in your
specific case some of the generated code is redundant.  You don't want
to penalize specific instances of the generic code pattern, after all.


T

-- 
The richest man is not he who has the most, but he who needs the least.


More information about the Digitalmars-d mailing list