| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Noah Roberts" |
| Date: |
04 Jan 2008 04:27:39 PM |
| Object: |
tool hunt |
Is there anything that will hunt down c-style casts and replace them
with the appropriate new-style cast?
.
|
|
| User: "Ivan Vecerina" |
|
| Title: Re: tool hunt |
04 Jan 2008 08:24:45 PM |
|
|
"Noah Roberts" <user@example.net> wrote in message
news:flmbsg$a1h$1@aioe.org...
: Is there anything that will hunt down c-style casts and replace them
: with the appropriate new-style cast?
Unfortunately, it pretty much would take a compiler to select the
proper new-style cast -- an automated tool would need to properly
disambiguate the cast from similar constructs, and to be aware
of inheritance etc.
So the best approach I could think of -- if you really care to
"upgrade" the code -- would be to manually go through the list
of C casts (can trigger a warning with various compilers), then
use a set of editor macros to convert to a new-style cast with
minimal keystrokes... no better idea unfortunately.
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <> http://www.brainbench.com
.
|
|
|
| User: "Noah Roberts" |
|
| Title: Re: tool hunt |
18 Jan 2008 05:10:41 PM |
|
|
Ivan Vecerina wrote:
would be to manually go through the list
of C casts (can trigger a warning with various compilers)
Anyone know if MSVC has such a warning? I can't find one.
.
|
|
|
|
|
| User: "Christopher Pisz" |
|
| Title: Re: tool hunt |
04 Jan 2008 05:04:00 PM |
|
|
"Noah Roberts" <user@example.net> wrote in message
news:flmbsg$a1h$1@aioe.org...
Is there anything that will hunt down c-style casts and replace them with
the appropriate new-style cast?
I dont know how anything but a compiler would know the differance between
(int *)somevar and foo(int *). I Imagine there are warning levels cause the
compiler to spew warnings about c style casts. At least in VS. I am not sure
about others. You'd have to check the docs.
.
|
|
|
|
| User: "Ioannis Vranos" |
|
| Title: Re: tool hunt |
04 Jan 2008 08:31:16 PM |
|
|
Noah Roberts wrote:
Is there anything that will hunt down c-style casts and replace them
with the appropriate new-style cast?
My opinion is, if the code is OK, do not bother to modify the casts. Use
the newest C++ casts in your new code.
.
|
|
|
|

|
Related Articles |
|
|