Exception isn't thrown as expected

Marco Leise Marco.Leise at gmx.de
Thu May 30 20:49:07 PDT 2013


Am Fri, 31 May 2013 10:26:49 +0700
schrieb Alexandr Druzhinin <drug2004 at bk.ru>:

> 31.05.2013 8:59, Adam D. Ruppe пишет:
> > three questions come to mind:
> >
> > 1) what operating system and 32 bit or 64 bit?
> > 2) what D compiler?
> > 3) are you sure you didn't catch the exception somewhere up the chain
> > and silence the message that way?
> 1) win7 64
> 2) dmd 32
> 3) I don't catch explicitly. To ensure it isn't catch some way 
> implicitly I just throw Exception without condition and it is thrown as 
> expected
> auto getObjectType() const {
>          throw new Exception("Here the exception should be thrown!"); // 
> works as expected
>          KeyHeaderHelper value_header;
>          value_header.ptr_ = cast(ubyte*) data_.ptr;
>          return value_header.object_type; // if data isn't null it hangs 
> up here
>      }
> 
> moreover, when I provide data_ always have some length, the application 
> starts hangin at return operator. I've met something like this behaviour 
> (I mean silent hanging up) earlier working with std.concurrency, but I 
> found some workaround. Now I dont know what to do.

The code that you haven't shown reads:

  int main(string[] args) {
      SomeClass c;
      auto t = c.getObjectType();
      return 0;
  }

You have to fix that!

-- 
Marco



More information about the Digitalmars-d-learn mailing list