Re:Typedefs & Linus
by Jach on Thursday October 14, 2010 @04:20AM
(#1790234)
I agree except for the part about typedef'ing pointers. If you never typecast a pointer, then you can't ever have compile time and run time encapsulation (better than C++ gives with "private"!) through opaque pointers...
[ Parent
| on HN ]
Why not? Just don't ship the definition of your struct in your headers, only declare them.
The API is more confusing if they always have to lug around the extra * and type out struct if they can never dereference it. I am strongly in favor of typedefing pointer types that are strictly private.