Why writeln can't be converted to nothrow with just catching of StdioException
pythonproof at gmail.com
Mon Feb 21 11:11:28 UTC 2022
On Monday, 21 February 2022 at 11:04:46 UTC, Mike Parker wrote:
> On Monday, 21 February 2022 at 10:49:13 UTC, partypooper wrote:
>> Do I completely not understand what is `nothrow` or why I
>> can't make function nothrow with just catching StdioException?
> D does not have checked exceptions like Java, so the compiler
> doesn't have anyway to verify that any function you call won't
> throw a given exception. You have to catch `Exception` to
> satisfy the `nothrow` requirement.
Oh, that's explain it.
So with such behavior there is no reason at all to make make
function nothrow, if it uses throw functions in its body? And as
much as I already know compliler can deduce and automatically
adds nothrow to all functions which do not throw exceptions.
More information about the Digitalmars-d-learn