NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/44800: Misplaced parenthesis.
The following reply was made to PR kern/44800; it has been noted by GNATS.
From: Marc Balmer <mbalmer%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Mindaugas Rasiukevicius <rmind%NetBSD.org@localhost>,
kern-bug-people%NetBSD.org@localhost,
gnats-admin%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost,
henning.petersen%t-online.de@localhost
Subject: Re: kern/44800: Misplaced parenthesis.
Date: Sat, 02 Apr 2011 21:24:38 +0200
Am 02.04.11 19:55, schrieb Mindaugas Rasiukevicius:
> The following reply was made to PR kern/44800; it has been noted by GNATS.
>
> From: Mindaugas Rasiukevicius <rmind%netbsd.org@localhost>
> To: David Laight <david%l8s.co.uk@localhost>,
> henning.petersen%t-online.de@localhost
> Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%netbsd.org@localhost
> Subject: Re: kern/44800: Misplaced parenthesis.
> Date: Sat, 2 Apr 2011 18:54:03 +0100
>
> David Laight <david%l8s.co.uk@localhost> wrote:
> > On Wed, Mar 30, 2011 at 12:40:00PM +0000,
> henning.petersen%t-online.de@localhost
> > wrote:
> > > >Number: 44800
> > ...
> > > - if ((error = vte_dma_alloc(sc) != 0))
> > > + if ((error = vte_dma_alloc(sc)) != 0)
> >
> > I would fix all these by moving the assignment out of the if.
> > > + error = vte_dma_alloc(sc);
> > > + if (error != 0)
> >
> > The code is easier to read, and has shorter lines.
>
> Yes, I prefer such style as well (it's not exactly KNF, though).
>
> error = vte_dma_alloc(sc);
> if (error) {
> ...
> }
This is C, get over it.
The idiom 'if ((err = xxx()) != 0)' is quite common and total ok to use.
Home |
Main Index |
Thread Index |
Old Index