[linux-dvb] Re: [PATCH] LGDT3302 Frontend Driver

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

 



On Tue, Jun 28, 2005 at 04:24:30PM +0200, Peter Beutner wrote:
> Edgar Toernig schrieb:
> >Michael Krufky wrote:
> >>>Yes but why do you need do {} while(0) stuff ?
> >>>You don't need to declare a new block as you add only a if statement, so
> >>>
> >>>+#define dprintk(args...) if (debug) printk(KERN_DEBUG "lgdt3302: " args)
> >>>
> >>>will be a lot's of cleanner...
> >>
> >>Agreed... I will add make that change.
> >
> >
> >Better not.  Code like this will brake horrible without the do-while:
> >
> >	if (foo)
> >		dprintk(...);
> >	else
> >		bar();
> >
> I dont see why the code you posted above will break with dprintk defined 
> like this:
> #define dprintk(args...) if (debug) printk(KERN_DEBUG "lgdt3302: " args)
> 
> Imo:
> 
> if(foo)
> 	if (debug) printk(KERN_DEBUG "lgdt3302: " args);
> else
> 	bar();
> 
> should work like intended.

The else will be part of the if (debug), not the if (foo) as
intended. This means that changing the dprintk macro would
end up breaking a number of things. Best to avoid these problems
in the first place.

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.




[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux