The types within this chain of conditional operators do not match and will
necessarily cause problems if the return value is ever used. With the final assertion,
which could possibly be disabled, this is even worse. The C
standard requires that the second and third argument of the conditional operator
?: are both void or compatible pointer types (there are several other cases, see
6.5.15 of the C Standard). Failing this, the compiler may produce arbitrary
code.
In this case, it seems best to cast each assignment to void to ensure a) consistent types
and b) that the return value can never be used.
SourceForge bug #193 written by Michael Tautschnig on 2013-03-06
In libvbi/exp-gfx.c PIXEL is declared as follows:
define PIXEL(d, i, s, j) \ (1 == bpp ? ((uint8_t )(d))[i] = \ ((const uint8_t )(s))[j] : \ (2 == bpp ? ((uint16_t )(d))[i] = \ ((const uint16_t )(s))[j] : \ (3 == bpp ? memcpy (((uint8_t )(d)) + (i) 3, \ ((const uint8_t )(s)) + (j) 3, 3) : \ (4 == bpp ? ((uint32_t )(d))[i] = \ ((const uint32_t )(s))[j] : \ assert (0)))))
The types within this chain of conditional operators do not match and will necessarily cause problems if the return value is ever used. With the final assertion, which could possibly be disabled, this is even worse. The C standard requires that the second and third argument of the conditional operator ?: are both void or compatible pointer types (there are several other cases, see 6.5.15 of the C Standard). Failing this, the compiler may produce arbitrary code.
In this case, it seems best to cast each assignment to void to ensure a) consistent types and b) that the return value can never be used.
Best, Michael