News for hackers. Stuff that matters.
Re:Using signed or unsigned int by default in C (2015) by qsort on Tuesday August 23, 2022 @03:08PM (#32569749)
The _t suffix is reserved for types defined by the standard. Although this is an excess of pedantry, strictly speaking you should not be defining names ending in _t.
Re:Using signed or unsigned int by default in C (2015) by mytailorisrich on Tuesday August 23, 2022 @03:25PM (#32570061)
By 'the standard' do you mean POSIX? Or has that been added to a C standard?

Either way, in general I'd agree this is an excess of pedantry and I don't really see an issue with using _t for types if that works for you.

Re:Using signed or unsigned int by default in C (2015) by qsort on Tuesday August 23, 2022 @03:40PM (#32570313)
I wasn't sure, I just checked.

POSIX reserves everything ending in _t. C99 and later reserve identifiers starting with "int" or "uint" and ending in "_t".

Source: https://en.cppreference.com/w/c/language/identifier

Re:Using signed or unsigned int by default in C (2015) by Someone on Tuesday August 23, 2022 @05:20PM (#32571691)
For those wondering: that phrase has to be read as “C99 and later reserve identifiers ((starting with "int" or "uint") and ending in "_t")”, not as “C99 and later reserve identifiers starting with "int" or "uint" and identifiers ending in "_t"”

It’s not as if a program with a variable called interest_rate or ford_model_t would be nonconforming according to the standard.

Re:Using signed or unsigned int by default in C (2015) by alerighi on Tuesday August 23, 2022 @04:26PM (#32571001)
While this is true, I don't see either a reason to use _t in your code. Since it's your code, you don't have the problem for which the _t suffix was introduced, that is to avoid conflicts that can break other people code. You don't either get any benefit of using the _t suffix, since it's obvious if something is a type or not, especially nowadays (just look at the syntax coloring). You don't even need the _t to distinguish for example between a struct, enum or union definition and it's relative typedef:

    typedef struct MyStruct { ... } MyStruct;
is perfectly valid, and in my opinion better than:

    typedef struct MyStruct_s { ... } MyStruct_t;
Where the suffix _s and _t doesn't add anything useful but only complicate the code for nothing.