What is "compatibility for C ++ mangling"?

A type

wint_tinstalls internally wchar.hthrough stddef.h, using the fact that it is __WINT_TYPE__already defined in the compiler by default. So, to change

typedef unsigned int wint_t;

at

typedef wchar_t wint_t;

we can use the following code at the beginning wchar.h

#undef __WINT_TYPE__
#define __WINT_TYPE__ wchar_t
#define WEOF (-1)

But this comment suggests that doing this "violates compatibility for C ++ mangling."

You cannot modify existing typedefs, such as wint_t, without breaking compatibility with ABI (even if you have the same size and subscription and, therefore, are ABI-compatible for C, changing the base type breaks compatibility for C ++ mangling).

So, why exactly this typedef cannot be changed and what is "compatibility for C ++ mangling"?

. wchar.h, wchar_t , wint_t?

+4
3

, :

- , , ++, " ", , , ClassA::method() ClassB::method() - ClassA::method(String s) ClassA::method(int i).

ClassA_method, ClassA_method^String, ClassA_method^int

, " - - " - , .

, typedef , , , DLL, typedef, .

+5

, C ++ . "C/++".

C mangling , ABI . , , wchar_t .

++ wchar_t typedef.

+3

, , . , .

, , . , ARM, Keil, -, GCC Clang /, mangling.

this.

, .

+2

Source: https://habr.com/ru/post/1661437/


All Articles