Chained Catch Statements

Jesse Phillips jessekphillips+D at gmail.com
Mon Jan 30 11:25:01 PST 2012


On Monday, 30 January 2012 at 18:23:56 UTC, Era Scarecrow wrote:
> try {
> } catch (Throwable t) {
>
> } catch {Exception e) { //never executed
>
> } catch (StreamException st) { //never executed
>
> } //and the list can go on forever.
>
> See the problem?

No?

Error: catch at test.d(3) hides catch at test.d(4)

The compiler does not reorder the exceptions because it enforces 
order in the written code. As you say the compiler knows the 
relationship, the one reading it may not.


More information about the Digitalmars-d-learn mailing list