tool hunt

Discussion in 'C++' started by Noah Roberts, Jan 4, 2008.

  1. Noah Roberts

    Noah Roberts Guest

    Is there anything that will hunt down c-style casts and replace them
    with the appropriate new-style cast?
     
    Noah Roberts, Jan 4, 2008
    #1
    1. Advertising

  2. "Noah Roberts" <> wrote in message
    news:flmbsg$a1h$...
    > 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.
     
    Christopher Pisz, Jan 4, 2008
    #2
    1. Advertising

  3. "Noah Roberts" <> wrote in message
    news:flmbsg$a1h$...
    : 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
     
    Ivan Vecerina, Jan 5, 2008
    #3
  4. 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.
     
    Ioannis Vranos, Jan 5, 2008
    #4
  5. Noah Roberts

    Noah Roberts Guest

    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.
     
    Noah Roberts, Jan 18, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mark | r

    bug hunt

    mark | r, May 26, 2004, in forum: HTML
    Replies:
    11
    Views:
    940
    Sid Ismail
    May 27, 2004
  2. jimspace

    Subtle Bugs in c++ hunt

    jimspace, May 4, 2005, in forum: C++
    Replies:
    7
    Views:
    435
    John Carson
    May 5, 2005
  3. Bill

    Thread Safe bug-hunt...

    Bill, May 19, 2006, in forum: C Programming
    Replies:
    1
    Views:
    299
    CBFalconer
    May 19, 2006
  4. Replies:
    11
    Views:
    544
    Chris Hills
    Jan 5, 2008
  5. Gerard A.W. Vreeswijk
    Replies:
    0
    Views:
    89
    Gerard A.W. Vreeswijk
    Aug 19, 2003
Loading...

Share This Page