В libstdc++ и libc++ type_info::operator== реализован через дефайн:
#if _PLATFORM_SUPPORTS_UNIQUE_TYPEINFO
bool operator==(const type_info& __rhs) const {
return __mangled_name == __rhs.__mangled_name;
}
#else
bool operator==(const type_info& __rhs) const {
return __mangled_name == __rhs.__mangled_name ||
strcmp(__mangled_name, __rhs.__mangled_name) == 0;
}
#endif
Т.е. есть какие-то платформы, где либо нет .so вообще,
либо гарантируется что при загрузке .so, динамическая линковка объединит данные RTTI.
Что это за платформы?
(если кому нужна карма на SO — дублируйте ответ
сюда)
ну а сами почему не сделали гуглсерч ?
http://www.macs.hw.ac.uk/~hwloidl/hackspace/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include/c++/4.8.3/typeinfo
[quote]
// Determine whether typeinfo names for the same type are merged (in which
// case comparison can just compare pointers) or not (in which case strings
// must be compared), and whether comparison is to be implemented inline or
// not. We used to do inline pointer comparison by default if weak symbols
// are available, but even with weak symbols sometimes names are not merged
// when objects are loaded with RTLD_LOCAL, so now we always use strcmp by
// default. For ABI compatibility, we do the strcmp inline if weak symbols
// are available, and out-of-line if not. Out-of-line pointer comparison
// is used where the object files are to be portable to multiple systems,
// some of which may not be able to use pointer comparison, but the
// particular system for which libstdc++ is being built can use pointer
// comparison; in particular for most ARM EABI systems, where the ABI
// specifies out-of-line comparison. The compiler's target configuration
// can override the defaults by defining __GXX_TYPEINFO_EQUALITY_INLINE to
// 1 or 0 to indicate whether or not comparison is inline, and
// __GXX_MERGED_TYPEINFO_NAMES to 1 or 0 to indicate whether or not pointer
// comparison can be used.
#ifndef __GXX_MERGED_TYPEINFO_NAMES
// By default, typeinfo names are not merged.
#define __GXX_MERGED_TYPEINFO_NAMES 0
#endif
[/quote]
Здравствуйте, reversecode, Вы писали:
R>ну а сами почему не сделали гуглсерч ?
R>http://www.macs.hw.ac.uk/~hwloidl/hackspace/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include/c++/4.8.3/typeinfo
R>[quote]
R>...комментарий на 20 строк...
R>[/quote]
ну на каких платформах-то?
в процитированных 20 строках было ясно сказано, я копипастить перевод с гугл транслеита не буду