In this answer of mine, I used _t at end of types, which ended at best, controversial. This is the practice I use in my current projects.

typedef struct {
    int x;
    int y;
} point_t;

This was intended to be consistent with C types from stddef.h like size_t or ptrdiff_t. However, according to certain comments in my questions, _t postfix appears to be reserved for POSIX. What should I use instead of _t? Or should I continue using _t anyway?

This question is for both C and C++. If these languages have different conventions, feel free to answer so.

  • 2
    One common convention is to have class names that LookLikeThis. At that point you don't even need suffixes. (This is more common for Java, .net etc. But it works in C++ as well.)
    – cHao
    Commented Jan 7, 2014 at 7:30
  • 2
    ultimately this is a form of Hungarian Notation. And that discussion is endless. I for one am against it now and go with cHao's solution. Why? Because I used Hungarian Notation for about 4 years for everything, then decided to do a project without it and didn't miss it at all. And didn't waste time on it. So I dropped it completely since it had, apparently, no value at all for me. And I never looked back.
    – stijn
    Commented Jan 7, 2014 at 15:02
  • 1
    See this question for reserved identifiers (including _t) stackoverflow.com/a/228797/14065 Commented Jan 8, 2014 at 20:27
  • Hungarian Notation is completely and utterly pointless in a language where types and expressions can't appear in the same syntactic position. C is just poorly designed due to a bunch of historical & social factors.
    – iono
    Commented Jul 19, 2022 at 6:06

3 Answers 3


There is no consensus within the C and C++ communities with regard to naming types.

Although the _t suffix is indeed reserved by POSIX, some will advocate using the _t suffix for your own types as well, while others will equally adamantly argue that you should not tempt fate by risking duplicate names with POSIX.

Alternative naming conventions suggest the use of a prefix for types, such as C or T.


I find suffixes rather ugly and so avoid _t etc. A good alternative is to use a capital letter to start type names, so Point in your example above.

  • 3
    and I find it nice to have a style DIFFERENT from the standard C types, so reading the code you can easily find what is from the client program and what is the API
    – Nikko
    Commented Jan 7, 2014 at 15:50
  • 2
    Also my favorite technique. Types have an initial uppercase letter. All other identifers are not types and thus easily seen. Commented Jan 8, 2014 at 20:29
  • I always thought it looked quite ugly as well. Good to see that other's agree with me.
    – syb0rg
    Commented Feb 1, 2014 at 3:40
  • 1
    I only use PascalCase for pointer types (Because of languages like C# and Java where PascalCase means class, i.e. reference to data) but I get where you're coming from.
    – yyny
    Commented Feb 22, 2016 at 12:50

It depends on you. Unless there is a conflict with the reserved words you are good to go. However, consider a scenario where you are working in a company and multiple people are accessing the same code base, and your code gets to a person who is not aware of your habit He/She can then assume that its a reserved type, especially if you write something like point_t. So, keep it simpler e.g. point is simpler than point_t. And if you want to append something to it, append you name initials.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.