winmm/tests: remove dead assignment (LLVM/Clang)

Joerg-Cyril.Hoehle at t-systems.com Joerg-Cyril.Hoehle at t-systems.com
Thu Feb 17 11:48:29 CST 2011


Hi,

Austin suggests:
>--- a/dlls/winmm/tests/wave.c
>-        first = FALSE;
-1

Some times you value consistency more than elimination of superfluous assignments.

All parts are written like this:
    if ((flags & WAVE_FORMAT_DIRECT) == WAVE_FORMAT_DIRECT) {
        if (!first) strcat(msg, "|");
        strcat(msg, "WAVE_FORMAT_DIRECT");
        first = FALSE;
    }
and you don't want to eliminate that one line in the last part just because
it happens to be the last one TODAY.  What if tomorrow another flag is added last
and the programmer oversees that s/he needs to reintroduce that first=FALSE statement?
Removing regularity is just error-prone and in the way of maintainability. Try to keep the code regular
and all parts alike, without exception for the last one.

It reminds me of the annoying issue with the trailing comma in structure initialisations,
which lead some people to instead use a style like this (well known in functional programming):
...
  ,     value_n
  ,     value_n+1
};

Isn't there a way to silence several complains from Clang which I consider stupid?

Regards,
 Jörg




More information about the wine-devel mailing list