На каких платформах type_info::op== не сравнивает строки?
От: Abyx Россия  
Дата: 11.04.18 12:27
Оценка:
В 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 — дублируйте ответ сюда)
In Zen We Trust
rtti
Re: На каких платформах type_info::op== не сравнивает строки?
От: reversecode google
Дата: 11.04.18 13:12
Оценка:
ну а сами почему не сделали гуглсерч ?

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]
Re[2]: На каких платформах type_info::op== не сравнивает строки?
От: Abyx Россия  
Дата: 11.04.18 13:38
Оценка:
Здравствуйте, 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]

ну на каких платформах-то?
In Zen We Trust
Re[3]: На каких платформах type_info::op== не сравнивает строки?
От: reversecode google
Дата: 11.04.18 14:02
Оценка:
в процитированных 20 строках было ясно сказано, я копипастить перевод с гугл транслеита не буду
Re[4]: На каких платформах type_info::op== не сравнивает строки?
От: Abyx Россия  
Дата: 11.04.18 17:35
Оценка: +4 :))
Здравствуй, reversecode, ты тут написал:

R>в процитированных 20 строках было ясно сказано, я копипастить перевод с гугл транслеита не буду


От души братишка. Сразу чувствуется что зашел на русский форум, аж прослезился.
In Zen We Trust
рак
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.