Which exception

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Mon Oct 30 07:28:00 PST 2006


Tom wrote:
> == Quote from Frits van Bommel (fvbommel at REMwOVExCAPSs.nl)'s article
[...]
>> The above code writes "DerivedException" to stdout, which is the name of
>> the most derived class ex is an instance of.
>> Am I missing something?
> 
> No, you're right. It works here, on a WinXP machine. When I get home later, I'll
> test it on my Linux, where it didn't work. I hope it's only my mistake and not a
> linux-specific bug.

Just tried it in my VMWare window:

     urxae at ubuntu:~/tmp$ cat test.d
     import std.stdio;

     class DerivedException : Exception { this() { super(""); } }

     void main() {
         try {
             // Code that throws some exception.
             throw new DerivedException;
         } catch (Exception ex) {
             writefln(ex.classinfo.name); // writes "DerivedException"
         }
     }
     urxae at ubuntu:~/tmp$ dmd -run test.d
     DerivedException
     urxae at ubuntu:~/tmp$ uname -a
     Linux ubuntu 2.6.17-10-386 #2 Fri Oct 13 18:41:40 UTC 2006 i686 
GNU/Linux

So that's not it either.



More information about the Digitalmars-d mailing list