Re: Exception Specification Compromise
In article
<82be602f-bb4e-45af-a04e-fcbeee7fdd02@z17g2000yqh.googlegroups.com>,
ThosRTanner <ttanner2@bloomberg.net> wrote:
That function *might* throw because the constructor for
std::vector<int> isn't declared throw().
A function won't throw if and only if the only functions it calls
doesn't throw (and it doesn't throw itself of course). What you can
never tell is if it it will throw but I don't think that's important.
It is trivially easy to statically analyse whether or not a function
might throw. You can even tell precisely what it might throw.
Not without whole program analysis.
For instance, how can you tell if the function qsort throws? You have
to analyze the compare function, which might be determined at run time.
Worse, what happens if that compare function calls a global function
stored in a tr1::function?
If the poster is really asking for a compiler extension, I'm not sure
why he is posting it here instead of asking his compiler vendor (along
with how much he is willing to contribute or pay to make it happen).
Personally, I don't see much traction on this, as most folks just aren't
seeing these kinds of issues very frequently (if at all) when using
exceptions in day to day usage.
--
Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> 773 961-1620
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]