[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
removing unnecessary parentheses in #if defined (FOO)
From: |
Jim Meyering |
Subject: |
removing unnecessary parentheses in #if defined (FOO) |
Date: |
Tue, 24 Jan 2006 19:15:06 +0100 |
Bruno Haible <address@hidden> wrote:
> Paul Eggert wrote:
>> I don't see any technical reason to prefer the parentheses.
>
> While I agree that there are no technical reason to put the parentheses,
> I wouldn't be religious on the issue, because the majority of the C
> programmers does it the other way. The same argument as for "const char *":
> http://lists.gnu.org/archive/html/bug-gnulib/2006-01/msg00024.html
IMHO, this is in a different class than the `char const *' vs.
`const char *' preference.
Personally, I'm not *too* religious about it, but you must admit the
parentheses in `#if defined (SYM)' add next to nothing in readability,
and actually detract as soon as you end up adding another layer of
parentheses:
#if (defined (S1) || defined (S2)) && defined (S3)
There, even with short-named symbols, we'd come close to having to
split the expression onto another line, while without the unnecessary
parentheses, we gain 6 columns. But more importantly, it's more
readable without the unnecessary syntax:
#if (defined S1 || defined S2) && defined S3
Re: socket.h, Simon Josefsson, 2006/01/24