3 ms·
What's the problem with typedef? It just names a new type rather than making things work differently than you'd expect.
by chc 10y ago
What's the problem with typedef? It just names a new type rather than making things work differently than you'd expect.
- hairy_man674 10y agoThe 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.