qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/5] CODING_STYLE: add preprocessor rules


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 1/5] CODING_STYLE: add preprocessor rules
Date: Sun, 15 Aug 2010 07:46:50 +0000

On Sat, Aug 14, 2010 at 2:27 PM, Andreas Färber <address@hidden> wrote:
> Am 13.08.2010 um 18:56 schrieb Blue Swirl:
>
>>>> +Use parenthesis when checking if a macro is defined, and use
>>>> +indentation to track nesting:
>>>> +
>>>> +#if defined(HAVE_POSIX_FALLOCATE) && !defined(HAVE_FALLOCATE)
>>>> +# define fallocate(a,ignored,b,c) posix_fallocate(a,b,c)
>>>> +#endif
>>
>> This one is new, current code doesn't use indentation. Maybe it's
>> better to drop it.
>
> Yes, please. While indentation is nice to read, it is patch-unfriendly.
>
> Consider:
>
> #ifdef SOMETHINGNEW
> yay
> #else // previous stuff follows
>
> #if defined(OLDONE)
> #  define one
> #endif
> foo
> bar
> #if defined(OLDTWO)
> #  define two
> #endif
>
> #endif
>
> Here, adding four lines would require to reindent six lines otherwise not
> changed, making merging and review harder.

I don't quite follow the example, but is the situation different from
adding a C 'if' statement and adjusting the indentation?

However, I'm not proposing this anymore.



reply via email to

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