Click to See Complete Forum and Search --> : Do you use static_cast/reinterpret_cast, etc. ?


tecknophreak
12-17-2003, 09:37 AM
I know that the recent gnu g++ compiler has a fit when you try to set an int to a char. Do you use the older (int) type-cast or the new *_cast type-casting? I started to use it a while back, it's quite addicting.

bwkaz
12-17-2003, 07:37 PM
I use the new casts:

(1) When I write C++, which is almost never, and

(2) When I remember that they exist. :o

Stuka
12-19-2003, 10:41 AM
I definitely do, or at least TRY to remember too, mainly because using the proper casts helps you to document your code, and to point out where there are kludges that you probably need to remove if possible. After all, in C++, you probably shouldn't be doing too many static_casts, unless you have some hard core requirements forcing them on you.