|
From: | Rik |
Subject: | Re: Why does mx-inlines.cc use throw ()? |
Date: | Tue, 3 May 2016 10:09:39 -0700 |
On 05/02/2016 10:44 PM,
address@hidden wrote:
My guess is that it is there for the compiler to help with optimization. With a name like mx-inlines.cc, I think the hope is that the compiler recognizes that these don't need to be full blown functions and can be inlined. See http://www.gotw.ca/publications/mill22.htm, where there is this comment, "Besides the overhead for generating the try/catch blocks shown above, which might be minor on efficient compilers, there are at least two other ways that exception specifications can commonly cost you in runtime performance. First, some compilers will automatically refuse to inline a function having an exception specification, just as they can apply other heuristics such as refusing to inline functions that have more than a certain number of nested statements or that contain any kind of loop construct. Second, some compilers don’t optimize exception-related knowledge well at all, and will add the above-shown try/catch blocks even when the function body provably can’t throw." This is about exception specifications, rather than saying the routine won't throw, but seems related. --Rik |
[Prev in Thread] | Current Thread | [Next in Thread] |