Gcc treats enum with non negative values as unsigned, so using the difference in a comparison function is questionable: http://cgit.freedesktop.org/cairo/tree/src/cairo-polygon-intersect.c#n794 for example adding a assert (a->type - b->type >= 0); gcc prints src/cairo-polygon-intersect.c|795 col 15| warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] assert (a->type - b->type >= 0); this means that three events (START, STOP, INTERSECTION) in the same place will be potentially each one after each other, making difficult to understand whether equally located STOP/INTER/START events should be really processed in that order or not.
But that is not equivalent. The equivalent assert would be assert((int)(a->type - b->type) >= 0);
(In reply to comment #1) > But that is not equivalent. The equivalent assert would be > assert((int)(a->type - b->type) >= 0); but that means that you are assigning/converting UINT_MAX - 1 or 2 to an int and gcc knows it cannot happen and I think after inlining and only checking the sign of the int gcc translates it to a->type != b->type
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/98.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.