[linux-dvb] Re: [PATCH] LGDT3302 Frontend Driver
Edgar Toernig
froese at gmx.de
Tue Jun 28 15:33:14 CEST 2005
Michael Krufky wrote:
> Edgar Toernig wrote:
> > Michael Krufky wrote:
> >
> >>>> +#define dprintk(args...) \
> >>>> +do { \
> >>>> +if (debug) printk(KERN_DEBUG "lgdt3302: " args); \
> >>>> +} while (0)
> >>>>
> >>> 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();
>
> Currently, I am using this:
>
> #define dprintk(args...) { if (debug) printk(KERN_DEBUG "lgdt3302: " args); }
>
> ...and it compiles cleanly.
But it's also broken - try it with my example.
Just put the do-while around it. That's C 101...
Ciao, ET.
PS: You mailer does strange things with spaces ...
More information about the linux-dvb
mailing list