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.

....Roy

Reply via email to