S
S
sddvxd2018-03-19 14:30:39
C++ / C#
sddvxd, 2018-03-19 14:30:39

What does _t mean in wchar_t type?

Actually, the question is in the title :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Shatunov, 2018-03-19
@sddvxd

This is called the GNU/POSIX naming agreement .

The requirement that additional types defined in this section end in "_t" was prompted by the problem of name space pollution. It is difficult to define a type (where that type is not one defined by POSIX.1-2008) in one header file and use it in another without adding symbols to the name space of the program. To allow implementors to provide their own types, all conforming applications are required to avoid symbols ending in "_t", which permits the implementor to provide additional types. Because a major use of types is in the definition of structure members, which can (and in many cases must) be added to the structures defined in POSIX.1-2008, the need for additional types is compelling.

Thus, to avoid the intersection of the type name with the names of other entities, the suffix "_t" is defined for the type names.
Additionally, GNU reserves the entire namespace for the "_t" suffix in order to extend the set of standard type names.
In general, the "_t" suffix carries a double meaning. First, it says that it is a type name. Second, it says that it is the name of a standard type.

D
Denis Zagaevsky, 2018-03-19
@zagayevskiy

Actually, it means that wchar_t is a type name. This is only for the programmer, in the sense that it means nothing to the compiler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question