开发者

What is the (recent?) significance of adding "_t" to class names in C++? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicates:

What does a type开发者_JS百科 followed by _t (underscore-t) represent?

What does the postfix “_t” stand for in C?

I've seen this more as of late. These are not typically templated classes, but rather just ordinary classes. Their names are all sensible, but they all tend to end with _t. I can't point to the libraries because they are proprietary, but I'm observing this in completely different libraries, across problem domains, so I'm assuming there is some kind of change in the naming conventions being used. Is this documented as a best practice anywhere?


As other already pointed, it's a naming convention used for type names (most of the time, typedefs). It have been used in the standard library (from the start?) so it's not recent at all.

For example you often see std::size_t and it's everywhere in the STL.

Some old C code I've read also use this convention so the origin might even be from C naming conventions, where you have to typedef a struct to get a "type".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜