Hacker News new | ask | show | jobs
by chc 3530 days ago
What's the problem with typedef? It just names a new type rather than making things work differently than you'd expect.
1 comments

The main misuse, again this is opinion based, is that it hides (obscures) the type of variable. If you have (say) a very large struct containing several member variables and functions, a programmer can be misled into returning it from a function or declaring it on the stack.

Of course there are reasonable uses for it. Contrary, to the above you might use it to intentionally make an object opaque as a way of abstracting its details from users or when declaring use of int/long in code.