[Issue 936] Optimization by compiler hints

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 10 10:28:38 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=936





------- Comment #5 from arkangath at gmail.com  2007-02-10 12:28 -------
When debugging code,conditions in asserts are expected to be *always* true, and
not probably. If we intent to have probable conditions, the release code would
have some sort of handling of such situations. Pragmas for probabilities are
not so useful. Consider that in a switch a case is more probable than other,
the programmer would just change the order of cases, and not adding a pragma to
do the same thing which would just bloat the code.

As an example, in a getCurrentDay() function, we expect the return value never
to be bigger than 31, and out{} contract would be perfect to (possibly)
optimize the code. It is a certainty, not a probability.


-- 



More information about the Digitalmars-d-bugs mailing list