g++ Compiler flag to highlight bugs if (0 <= amplitudeH <= 1)

Discussion in 'C++' started by cernspam@gmail.com, Oct 3, 2012.

  1. Guest

    I've inherited code which contains loads of nasty bugs as above (I'd expect it to be if ((0 <= amplitudeH) && (amplitudeH<= 1)).

    Is there any way for the compiler to warn of this ambiguous type of code?
    , Oct 3, 2012
    #1
    1. Advertising

  2. wrote in message
    news:...
    >
    >I've inherited code which contains loads of nasty bugs as above (I'd expect
    >it to be if ((0 <= amplitudeH) && (amplitudeH<= 1)).
    >
    >Is there any way for the compiler to warn of this ambiguous type of code?


    For many years we have been very happy with FlexeLint
    (http://www.gimpel.com). Although modern compilers start to be more
    informative about such valid, but questionable use of language constructs,
    they still do not beat FlexeLint.
    Fred Zwarts \(KVI\), Oct 3, 2012
    #2
    1. Advertising

  3. Marc Guest

    wrote:

    > I've inherited code which contains loads of nasty bugs as above (I'd expect it to be if ((0 <= amplitudeH) && (amplitudeH<= 1)).
    >
    > Is there any way for the compiler to warn of this ambiguous type of code?


    warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
    (this comes by default with -Wall)
    Marc, Oct 4, 2012
    #3
    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. Bura Tino
    Replies:
    7
    Views:
    763
    Dale King
    Apr 15, 2006
  2. Nathan Pinno
    Replies:
    9
    Views:
    344
    Mensanator
    Mar 12, 2008
  3. Terry
    Replies:
    2
    Views:
    406
    Terry
    Jul 3, 2011
  4. news.aon.at
    Replies:
    36
    Views:
    2,100
    Tim Rentsch
    Jan 26, 2012
  5. Josef 'Jupp' Schugt

    Still use 'ruby-bugs' for Ruby bugs?

    Josef 'Jupp' Schugt, Nov 4, 2004, in forum: Ruby
    Replies:
    2
    Views:
    160
    Tom Copeland
    Nov 4, 2004
Loading...

Share This Page