dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #18819
Re: GenericTensor::down_cast() should throw std::bad_cast instead of invoking dolfin::error
On Sun, 2010-08-01 at 12:40 +0200, Florian Rathgeber wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> When using GenericTensor::down_cast() for a tentative down cast it would
> be helpful if it would throw std::bad_alloc (as any dynamic_cast would
> do)
Do you mean std::bad_cast?
> instead of invoking dolfin::error. Currently you would have to catch
> std::runtime_error and check what() to distinguish a failed cast from
> another dolfin::error, which is pretty inconvenient. Is there a specific
> reason why it is implemented this way?
>
Not really.
It's not too clear to me what you'd like. Would you prefer that
down_cast doesn't throw an error, but leave it up to the programmer to
check that a cast was successful, or just that DOLFIN catch a
std::bad_cast and print more information before throwing an error?
Garth
> Florian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.12 (MingW32)
>
> iEYEARECAAYFAkxVTwUACgkQ8Z6llsctAxZL/ACdF7itkMxz9NX1GAx7m3bxw0jH
> LxUAoNqcxH5oXt7Q6q559s472RVGFuc/
> =rxNO
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help : https://help.launchpad.net/ListHelp
Follow ups
References