On Wednesday, 27 May 2020 at 09:44:56 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 09:42:58 UTC, Mike Parker wrote:
On Wednesday, 27 May 2020 at 09:40:08 UTC, wjoe wrote:
The compiler will complain that bar(int) isn't nothrow.
What's the best way to find out which Exceptions aren't
handled inside of foo() for foo to be able to be nothrow
without using a 'catch (Exception){}' catch-all?
`catch(Exception)`.
I should add that if you're only catching specific exceptions
in a `nothrow` function, then it isn't `nothrow`. You have to
catch Exception because D does not have exception
specifications. I would expect the compiler to complain if you
try to do otherwise.
Thanks for the fast reply, Mike.
The problem with catch(Exception) is that it's run time whereas
I'd like to know compile time which exception may possibly be
thrown.
So I take it the only way to find out what may be thrown is to
read the source code of the called function(s) and the rat tail
that follows - and to rely on documentation to be accurate and
complete if the source code isn't available.
That's sort of annoying.