[Top][All Lists]

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

Re: [Qemu-devel] [PATCH 1.1] virtio: Fix compiler warning for non Linux

From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 1.1] virtio: Fix compiler warning for non Linux hosts
Date: Mon, 28 May 2012 13:52:33 +0100

On 28 May 2012 13:39, Stefan Hajnoczi <address@hidden> wrote:
> Agreed, people have been asked to declare variables at the beginning
> of the scope.  I don't understand why, C99 allows them to be declared
> anywhere and it usually makes the code more readable IMO (you don't
> have to jump to the definition to check a variable's type).

If the definition is that far away from the use it's probably a
sign that your function is too large anyway and you should be
looking for a smaller scope within which to declare the variable...

> What's the problem with C99-style variable declarations anywhere in a 
> function?

I think they look slightly uglier but that's purely a personal
prejudice which I don't think I can justify imposing on anybody
else :-)

-- PMM

reply via email to

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