为什么类型关键字以“_t”后缀结尾?

Why are type keywords ended with "_t" suffix?

我知道 size_t_t 后缀,因为它的别名是 /typedef。但是我不明白为什么 char16_tchar32_twchar_t 包含 _t 后缀。

对于wchar_t:

In C++, wchar_t is a distinct fundamental type (and thus it is not defined in <cwchar> nor any other header).

In C, this is a typedef of an integral type.

对于char16_tchar32_t,在<cuchar>/uchar.c中定义:

In C, this header defines two macros: char16_t and char32_t, which map to unsigned integral types of the appropriate size (the same as uint_least16_t and uint_least32_t, respectively).

In C++, char16_t and char32_t are fundamental types (and thus this header does not define such macros in C++).

因此,在这两种情况下,即使它们是 C++ 中的基本类型,它们仍保留 _t 以与 C 兼容,它们是 typedef 或宏。