I'm interested in c++ style casts; is there a canonical list which shows which
compilers allow this?
[ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
[ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
Should the use of the C++ casting functions be mandated over the use of
C-style casting in all situations?
I understand the need for dynamic_cast and when it should be used, I think
it's great and it offers considerable value. I know when to use
reinterpret_cast for function pointers. I also understand that I can use
the C-Style casting form for converting native data types and enumerations
(being careful to note any truncation, etc.)
However, I am struggling with const_cast and static_cast. The context would
be an application where I'm forced to live with a signature that is
essentially wrong in declaring an argument as const when it should not have
been. Is it "evil" for me to use the C-style casting? I know I can use the
C++ casting functions, but I guess it seems a bother. I've read that
cloning the object would be a workaround, but this just seems like overkill
in my situation.
My perspective on this situation and that of using static_cast, is that the
compiler essentially does some checking at compile time, but at run-time it
just moves the value of the pointer anyway, it doesn't seem to do any
validation. I know I'd be losing this up-front checking. If I (and the
team) know what we're doing and can be trusted (I know, I know,...); is it
so wrong to use C-Style casting in a case like I've described.
thanks for your help and opinions!
[ about comp.lang.c++.moderated. First time posters: do this! ]