0

Possible Duplicates:
What does a type 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?

Community
  • 1
  • 1
Rhubarb
  • 3,893
  • 6
  • 41
  • 55
  • See [What does a type followed by _t (underscore-t) represent?](http://stackoverflow.com/questions/231760) and [What does the postfix “_t” stand for in C?](http://stackoverflow.com/questions/1391447) – ChrisW Sep 05 '10 at 09:28
  • 1
    One thing the dupes didn't mention was that my editor recognizes things ending in `_t` as type names and colors appropriately. Since an editor can't really be expected to fully parse your program to figure out what's a type and what isn't, this can be helpful in having the program make more sense at a quick glance. That's why I continue to use the convention. – Omnifarious Sep 05 '10 at 10:51

1 Answers1

1

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".

Klaim
  • 67,274
  • 36
  • 133
  • 188