Non-representative line



  • Found this line of C++ while investigating the 10,000+ warnings produced by some code:

    	parinfo.table.cell_v_extra << 16;						
    

    There are a few more lines like it scattered throughout the codebase.



  • That's a typo, not a WTF. The WTF is whoever ignored the warnings for so long that they accumulated to over 10000.

    The problem with ignoring gobs of warnings because you "know" they are harmless, is that even if they ARE harmless, they make it almost impossible to see the one warnings that actually is important.

    Ugh.



  • @smxlong said:

    That's a typo, not a WTF. The WTF is whoever ignored the warnings for so long that they accumulated to over 10000.

    The huge number of warnings are from a compiler change. CodeWarrior doesn't warn about things like "Enumeration value not handled in switch", "Unknown #pragma", or "/* used within comment", which make up the bulk of the warnings.



  • @Carnildo said:

    @smxlong said:
    That's a typo, not a WTF. The WTF is whoever ignored the warnings for so long that they accumulated to over 10000.

    The huge number of warnings are from a compiler change. CodeWarrior doesn't warn about things like "Enumeration value not handled in switch", "Unknown #pragma", or "/* used within comment", which make up the bulk of the warnings.

    I can buy that, but it still seems like even the old compiler should have warned on a statement that has no effect. If not, perhaps the choice of compiler was the WTF.



  • @smxlong said:

    The WTF is whoever ignored the warnings for so long that they accumulated to over 10000
    I think you mean over nine thousand.



  • Uhm, no effect? It's C++. Does "std::cout << 16;" have no effect too? I can see the OP line being a completely normal, non-WTFish statement.



  • I still think overriding const operators (those that return a result without having a side effect on the operands) with ones that do have effects is the real wtf. Even better is the fact that <<'s precedence is before some things you'd want to use in a cout line.

    It would make more sense for cout to be using an assignment type operator like "<<=", except for the fact that they evaluate right-to-left. The comma operator has the right precedence and evaluation order, but would look wierd.



  • @Abdiel said:

    Uhm, no effect? It's C++. Does "std::cout << 16;" have no effect too? I can see the OP line being a completely normal, non-WTFish statement.

    I know this is a weird idea, but maybe the compiler is, you know, aware of the types of the expressions on either side of the operator?

    I guess it's possible that the LHS is some class type with an overloaded operator<<(), but I doubt it.


Log in to reply