httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Coding style
Date Mon, 02 Oct 2006 18:56:49 GMT
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.

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)

Can I suggest adopting this as a guideline for new code,
to avoid this kind of bug?

[1] PR#40656 and 40658-40662

-- 
Nick Kew

Mime
View raw message