The thing is, typecasting is /bad/. The general rule is, if you''re using casting, you''re doing it wrong. And yet here are Microsoft, forcing developers to use typecasting.
Even though it''s not, really, because they''re all the same thing, just given different names.
TheTwistedOne
http://www.angrycake.com
Visual C++ 6.0 WTF?
Who ever told you typecasting is bad? It''s almost impossible to any real work in C/C++ without typecasting, no matter how well the system is designed. There are even build-in typecasting operators in C++. dynamic_cast, static_cast, etc. Or where you just taking this opportunity to do some pointless MS bashing?
"That which the flame does not consume...consumes the flame. "
"That which the flame does not consume...consumes the flame. "
"That which the flame does not consume...consumes the flame. "
Type casting is neither wrong nor bad. In any strongly-typed language such as C (to a lesser extent) or C++ one should/must be very careful about what types are used where. Type casts help to make everything clear and consistent *by the programmer* instead of relying on the *compiler* to figure out what''s going on. Yes, the compiler can do it just fine, but, then, why not just use a language like BASIC which allows you to assign whatever value to whatever variable, virtually eliminating the need for casting at all? =)
Typecasting is good. Typecasting is powerful. Typecasting can, however, get you into serious trouble if you don''t know what you''re doing, which is probably why somebody (probably a teacher in an early CS class) told you it''s a bad thing. There''s really nothing wrong with M$ making people typecast... we were casting here at work long before VC6 made it necessary for compilation simply because it makes it easier to read the code.
-fel
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement