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

On 7/2/2010 6:10 PM, Jonathan M Davis wrote:
On Friday, July 02, 2010 13:57:33 David Simcha wrote:

bool evalPred(alias pred)(uint num) {
     // This line is to make sure that this function doesn't get inlined
into // main.  DMD doesn't inline functions that could throw.
     if(num == uint.max) {
         throw new Exception("");
     }

     return pred(num);
}
DMD doesn't inline functions that could throw? Isn't that rather restrictive?
I'm assuming that that's functions with an actual throw statement rather than
all functions that aren't nothrow, since that would _really_ be restrictive. But
still, you could have a really small function that threw if a condition failed
but otherwise just returned a value, and I would have thought that that would be
worth inlining. I'm far from an expert once you're dealing with stuff that low-
level, so there could be a very good reason that functions that could throw
aren't inlined, but it does strike me as rather restrictive if you can't inline
such functions.

- Jonathan M Davis
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos


_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to