kernel coding style for if ... else which cross #ifdef

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: lkml <linux-kernel@...>
Date: Friday, May 23, 2008 - 3:11 pm

A question splitting "else" and "if" on distinct lines vs. using an
extra line and extra #else came up as I was reviewing a proposed cifs
patch.   Which is the preferred style?

#ifdef CONFIG_SOMETHING
   if (foo)
      something ...
   else
#endif
   if ((mode & S_IWUGO) == 0)

or alternatively

#ifdef CONFIG_SOMETHING
   if (foo)
      something ...
   else if ((mode & S_IWUGO) == 0)
#else
   if ((mode & S_IWUGO) == 0)
#endif


-- 
Thanks,

Steve
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
kernel coding style for if ... else which cross #ifdef, Steve French, (Fri May 23, 3:11 pm)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Fri May 23, 7:03 pm)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sat May 24, 1:42 am)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sat May 24, 2:08 pm)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 6:06 am)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 10:35 am)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 11:45 am)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sat May 24, 2:12 pm)
Re: kernel coding style for if ... else which cross #ifdef, Vegard Nossum, (Sat May 24, 11:57 am)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sat May 24, 2:12 pm)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 12:02 pm)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 4:38 pm)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sat May 24, 4:43 pm)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 4:51 pm)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sat May 24, 4:54 pm)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 5:15 pm)
Re: kernel coding style for if ... else which cross #ifdef, H. Peter Anvin, (Sun May 25, 8:27 pm)
Re: kernel coding style for if ... else which cross #ifdef, Willy Tarreau, (Sat May 24, 10:39 am)
Re: kernel coding style for if ... else which cross #ifdef, Jeremy Fitzhardinge, (Sat May 24, 10:41 am)
Re: kernel coding style for if ... else which cross #ifdef, Willy Tarreau, (Sat May 24, 10:46 am)