Christopher Smith wrote:
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.
That's why they suck, yes. That's precisely what I'm saying. :-) I'm
not sure what's "unfair" about the observation.
OK. Typedefs suck for improving the reliability of your code, even if
they might help the readability. Unfortunately, I don't think they help
the readability if you can pass a H into a function expecting a V,
because I think you might gloss over this bug because you'd unconciously
expect a type error there. I.e., it really *isn't* improving the
readability, and comments would be better because at least you know the
compiler won't check.
What's the benefit of tye typedefs above over
int h; /* The horizontal pixel count */
int v; /* The vertical pixel count */
--
Darren New / San Diego, CA, USA (PST)
It's not feature creep if you put it
at the end and adjust the release date.
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg