qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [FOR 0.12 PATCH 2/4] pci: don't hw_error() when no


From: Gleb Natapov
Subject: Re: [Qemu-devel] Re: [FOR 0.12 PATCH 2/4] pci: don't hw_error() when no slot is available.
Date: Fri, 11 Dec 2009 13:03:30 +0200

On Fri, Dec 11, 2009 at 12:37:31PM +0200, Michael S. Tsirkin wrote:
> On Thu, Dec 10, 2009 at 09:13:06PM +0200, Gleb Natapov wrote:
> > On Thu, Dec 10, 2009 at 08:04:56PM +0200, Michael S. Tsirkin wrote:
> > > On Thu, Dec 10, 2009 at 03:22:52PM +0200, Gleb Natapov wrote:
> > > > On Thu, Dec 10, 2009 at 02:23:05PM +0200, Michael S. Tsirkin wrote:
> > > > > On Thu, Dec 10, 2009 at 01:19:10PM +0100, Gerd Hoffmann wrote:
> > > > > >   Hi,
> > > > > >
> > > > > >>> +    if (pci_dev == NULL) {
> > > > > >>> +        hw_error("PCI: can't register device\n");
> > > > > >>> +    }
> > > > > >>
> > > > > >> Can you please use !pci_dev for these checks?
> > > > > >
> > > > > > Why?  IMHO the code is more readable that way.  It is easy to miss 
> > > > > > a  
> > > > > > single '!' character when reading the code, so I tend to write such 
> > > > > >  
> > > > > > tests in a more verbose fashion.
> > > > > >
> > > > > > cheers,
> > > > > >   Gerd
> > > > > 
> > > > > Reader has limited short term memory. Don't fill it up with
> > > > > irrelevant detail. In places where it might be confusing,
> > > > > a comment might be appropriate, this is not one of them.
> > > > > 
> > > > > C is a terse language. !x is a standard idiom. Let's use it.
> > > > > 
> > > > ! is for boolean.
> > > 
> > > In which language? Not in C.
> > > 
> > In boolean. My point is no need to force your style on everyone
> 
> I am not forcing style on anyone - how can I do this?  I hacked on pci
> and by now there's no == NULL in pci.c anywhere ;). I will be
> happier if none is added now.
> 
> > if it is not in coding style document.
> 
> Heh, we don't need to document everything.
> 
> > == often much more readable then !.
> 
> Matter of taste probably.
> 
Exactly! (Or should I say "Exactly=="?)

--
                        Gleb.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]