3 ms·
Typedefs (Linus Torvalds)
- wahern 10y agoThe consensus in the C community, not just Linux, is still that typedef'ing structs is a bad idea, and typedef'ing pointers to structs is particularly egregious. _One_ of the several reasons its poor practice is because it makes it less obvious whether an object uses pass-by-value or pass-by-reference semantics. To novice C programmers this sounds like a good thing; but experienced C programmers know there's a fine line between encapsulation and obfuscation in C. Also, FWIW, _t is a reserved suffix in POSIX. While most people don't care, and it's very common to use that suffix to typedef integral types, it's worthwhile to at least think twice before using the _t suffix. If your application code actually sees widespread use, your misuse of the suffix might cause future standards writers to resort to a less obvious naming scheme for a new feature.