httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <>
Subject Re: Coding style
Date Mon, 02 Oct 2006 22:31:50 GMT
On Oct 2, 2006, at 11:56 AM, Nick Kew wrote:

> We have a bunch of new bug reports[1], detailing bugs of the form
>    if ((rv = do_something(args) == APR_SUCCESS))
> for
>     if ((rv = do_something(args)) == APR_SUCCESS)
> Of course, that's a C classic, and can be a *** to spot.

Huh, just turn on the warnings.  Or use lint.

> We can avoid this by adopting an alternative coding style
> that doesn't rely on confusing parentheses:
>   if (rv = do_something(args), rv == APR_SUCCESS)

Which nobody uses because it is so weird and unusual (speaking as a perl
programmer who uses even more weird and unusual syntax all the time).
It wouldn't surprise me at all to find that it doesn't even compile with
some of the older C compilers, though I haven't tested it.

I prefer the existing convention.  +1 on fixing the bugs.


View raw message