[Issue 3020] No description is given why function may not be nothrow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 29 11:12:23 PDT 2010


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


Andrei Alexandrescu <andrei at metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at metalanguage.com


--- Comment #9 from Andrei Alexandrescu <andrei at metalanguage.com> 2010-10-29 11:11:26 PDT ---
(In reply to comment #5)
> Out of memory errors should be allowed inside nothrow.
> 
> Also, I suspect it would be good to disallow:
> 
> try
> {
>    ...
> }
> catch (Exception e)
> {
>    /* nothing here */
> }
> 
> where all exceptions are swallowed and ignored. This kind of thing happens in
> Java to work around exception specifications, but I don't see a need for it
> here. Of course, there would still be ways to swallow & ignore (just put in a
> call to a do-nothing function), but such shouldn't be easy.
> 
> What do you think?

There are plenty of cases when you want to swallow exceptions, and it's highly
unlikely that anyone would write such a pattern by mistake. So let's keep
allowing it. At best, the compiler could protest that "e" is not being used and
ask for a nameless catch.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list