On Mon, 18 Feb 2013, John Peterson wrote:

If !LIBMESH_HAVE_RTTI, libmesh_cast_ptr will do a static_cast, which from a few 
test codes I
have never seems to return NULL, so you could get a false 'true' from this 
function.

This would affect any RTTI-disabled code storing two different types by the 
same name.  I.e.

  equation_systems.parameters.set<Real>("speed")          = 1000.;
  equation_systems.parameters.set<int>("speed")          = 5;

would do something unexpected.

Indeed, it would give you garbage in "speed".  Worse, mix in a
dynamically allocated type like std::string and you can get stray
pointers, data corruption, crashes, etc.

But, in the case where the user really doesn't have or want RTTI, this
seemed to be the lesser of two evils.  "You have to write your code to
avoid using identically named parameters with different types" was the
only solution I could see short of "you have to write your code to
avoid using parameters".
---
Roy
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to