qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3] implementing victim TLB for QEMU system emul


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v3] implementing victim TLB for QEMU system emulated TLB
Date: Sun, 2 Feb 2014 18:33:05 +0000

On 2 February 2014 18:27, Xin Tong <address@hidden> wrote:
> On Sun, Feb 2, 2014 at 10:19 AM, Peter Maydell <address@hidden> wrote:
>> Statement expressions are supported by both gcc and clang,
>> which is the set of compilers we care about.
>
> Ok got it. would moving vtlb_idx inside the macro break the C89 rule
> of "No Variable declaration in middle of block"

No, because the macro has a block inside it. "block" means
"a chunk of code inside {}", not "an entire function". You can
declare variables at the start of functions, or at the start
of the block in a while loop, or at the start of the blocks in
an if () {...} else {...}, or (as in this case) at the start of the
block inside a C statement expr.

If you want to restrict the scope of a variable and you don't
have a block conveniently to hand, it's always valid just to
create one: C syntax allows a bare "{ /* code here */ }"
anywhere a statement is valid. It's almost always the case
that there's some handy control-flow-mandated block to
use, though.

thanks
-- PMM



reply via email to

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