[PATCH] Lost parenthesis in a recent libXaw change

Colin Harrison colin.harrison at virgin.net
Tue Oct 20 09:59:25 PDT 2009


> -----Original Message-----
> From: Colin Harrison [mailto:colin.harrison at virgin.net] 
> Sent: 20 October 2009 17:34
> To: 'xorg-devel at lists.x.org'
> Subject: PATCH Lost parenthesis in a recent libXaw change
> 
> Hi,
> 
> Don’t we still need the parenthesis in the recent libXaw change?
> 
> http://lists.freedesktop.org/archives/xorg-commit/2009-October
> /023796.html
> 
> 
> --- ./src/save_AsciiSrc.c       2009-10-20 16:29:07.000000000 +0100
> +++ ./src/AsciiSrc.c    2009-10-20 16:34:55.000000000 +0100
> @@ -1292,7 +1292,7 @@
>  {
>      int fd;
> 
> -    if (fd = creat(name, 0666) == -1)
> +    if ((fd = creat(name, 0666)) == -1)
>         return (False);
> 
>      if (write(fd, string, length) == -1) {
> 
> Thanks,
> Colin
> 
PS and the proof

#include <stdio.h>
int main(int argc, char* argv[])
{
int i1, i2;

if (i1 = sizeof(int) == 4) printf ("Bad i1 = %d\n", i1);
if ((i2 = sizeof(int)) == 4) printf ("Good i2 = %d\n", i2);

return 0;
}

# cc -Wall test.c
test.c: In function `main':
test.c:6: warning: suggest parentheses around assignment used as truth value

# ./a.out
Bad i1 = 1
Good i2 = 4

Don't you just love C coding.

Thanks,
Colin



More information about the xorg-devel mailing list