Darren New wrote: > Gabriel Sechan wrote: >> Note: to get this absolutely right, use of typedefs is a must. > > Actually, typedefs suck. What you really want is to be able to have > multiple incompatible types, all identical to "int". Why would I prefer > > typedef int HorizontalPixelCount; > typedef int VerticalPixelCount; > > and make it so I could add those two together? Come on, play fair guys.
That would be a misuse of a typedef. A typedef is an alias, not a new type. A typedef provides some indirection/encapsulation to how you specify a type, and *that* is where it's an advantage and entirely appropriate to use. I can abuse "class" as a pseudo-alias for types and demonstrate where it is has horrid consequences as well (oh, the fun you can have with smart pointers), but presumably you would not accept that as some kind of proof that classes suck. --Chris -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
