Re: [hackers] [dmenu][PATCH] Remove warning for int comparison as bool

From: Laslo Hunhold <>
Date: Fri, 25 Feb 2022 08:32:29 +0100

On Fri, 25 Feb 2022 11:07:49 +0530
Prathu Baronia <> wrote:

Dear Prathu,

> - Compare the result of the macro with 0 instead of treating as bool
> to remove the following warning.

I'm not sure if the patch is correct, but maybe it would be a better
thing to go all the way and turn INTERSECT into a proper function for
better readability.

intersect_area(int x, int y, int width, int height, XineramaScreenInfo *info)
        return ((MIN(x + width, info.x_org + info.width) - MAX(x, info.x_org)) *
                (MIN(y + height, info.y_org + info.height) - MAX(y, info.y_org)));

I find this much more readable than the macro and the extended naming
makes clear that INTERSECT returns an area and not just a boolean expression.
It would need to be put in an #ifdef XINERAMA.

With best regards

Received on Fri Feb 25 2022 - 08:32:29 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 25 2022 - 08:36:35 CET