lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] Understanding the jit_set_ip


From: Paolo Bonzini
Subject: Re: [Lightning] Understanding the jit_set_ip
Date: Wed, 30 Jun 2010 17:33:05 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5

On 06/30/2010 05:25 PM, Mathieu Suen wrote:
Hi

It is more a C related syntax question but here it is.

I don't understand what does it mean:
#define    jit_set_ip(ptr)            (_jit.x.pc = (ptr), jit_get_ip ())

Especially near the coma.

My guess is if we got:
a = jit_set_ip(foo);

it is going to be expand in:


No, it expands to

  a = (_jit.x.pc = (ptr), jit_get_ip ())

which is indeed the same as

  _jit.x.pc = (foo);
  a = jit_get_ip();

It's exactly the same syntax that you use for

  for (i = 0, j = strlen (x); i < --j; i++)
    {
      char t = x[i];
      x[i] = x[j];
      x[j] = t;
    }

(typical textbook example for reversing a string) except that in this case you're using the result of the comma operator, which is the rightmost operand. That would be "j = strlen (x)" in the example.

Paolo



reply via email to

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