home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 33,332 of 33,346   
   Thomas Richter to All   
   Re: Uniquely identifying types at runtim   
   17 May 14 17:56:54   
   
   From: thor@math.tu-berlin.de   
      
   Am 16.05.2014 08:38, schrieb fmatthew5876:   
   >   
   > It sounds like typeid() could be perfect for this use case. This use case   
   > has nothing to do with polymorphism or dynamic_cast. Can I safely use   
   > typeid() and std::type_info for this purpose? I tested it out on gcc and   
   > it looks like type_info uses the mangled typename so it should work fine,   
   > but I wanted to double check to see if I am missing any gotchas on this.   
      
   The output of typeid() is compiler dependent and not standardized. In   
   specific, if a library is compiled with a different compiler, typeid() may   
   work completely different, thus you cannot compare the output of typeid() from   
   the code generated by one    
   compiler with the output of typeid() created by another compiler.   
      
   Many operating systems or linkers do not even offer a consistent C++ library   
   interface, again because name mangling is compiler specific. Thus, you would   
   need to find a way to tranport the information over a C interface.   
      
   Greetings,   
   	Thomas   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca