[cairo] Signed - unsigned mismatch

cu cairouser at yahoo.com
Sat Jun 19 08:12:42 PDT 2010


This is an issue that existed for a long time, and something I only
started looking at during the recent signed/unsigned problem.

Essentially I see a lot of signed/unsigned mismatch warnings (sometimes
different) when compiling cairo both on Windows and other systems.

Here is just a small set of what I find:

cairo-wideint-private.h(181) : warning C4146: unary minus operator
applied to unsigned type, result still unsigned
This one is a true problem methinks. The line reads:
qr.quo = (cairo_int64_t) _cairo_int64_negate (uqr.quo);
Where _cairo_int64_negate is defined as "-(a)", but uqr.quo is an
unsigned type. So, whats "- unsigned type" cast to signed? I don't know
but it is not the same thing as unsigned type first cast to signed and
then negated (which is probably what this should do, right?)

Then there are these:
cairo-win32-surface.c(1234) : warning C4018: '<' : signed/unsigned mismatch
cairo-win32-surface.c(1240) : warning C4018: '>' : signed/unsigned mismatch
cairo-win32-surface.c(1244) : warning C4018: '<' : signed/unsigned mismatch

All due to _cairo_rectangle_int (signed) being used in structures, but
uint32_t in the function (why not the same type?)

This is from compiling just one file. I seem to be getting similar
issues practically everywhere.

Should I (or anyone else) be worried?



More information about the cairo mailing list