Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this answer of mine, I used _t at end of types, which ended at best, controve

ID: 655045 • Letter: I

Question

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.

Explanation / Answer

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.