ruohoruotsi / Butterworth-Filter-Design

C++ classes for designing high-order Butterworth IIR & equalization filters
GNU General Public License v3.0
163 stars 42 forks source link

conditional statement possible error #8

Open ahadji05 opened 8 months ago

ahadji05 commented 8 months ago

In Butterworth.cpp , in this piece of code (line 201):

    // correct the overall gain
    if(filter == kLoPass || filter == kBandPass){ // pre-blt is okay for S-plane
        ba[0] = preBLTgain * (preBLTgain / gain); // 2nd term is how much BLT boosts,
    }
    else if(filter == kHiPass || kBandStop){ // HF gain != DC gain
        ba[0] = 1 / ba[0];
    }

My compiler complains about the line: else if(filter == kHiPass || kBandStop){ // HF gain != DC gain

error: converting the enum constant to a boolean [-Werror,-Wint-in-bool-context]
    else if(filter == kHiPass || kBandStop){ // HF gain != DC gain

I am using: icpx -Wall -Wextra -pedantic -Werror -Wno-unused-parameter

ruohoruotsi commented 8 months ago

Thank you for filing the issue ... what version of C++ compiler are you using, on what platform? This code is a bit old and so, it may need a PR to update it to modern compilers. Looking fwd>> to your response.