All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Mark Williamson <mark.williamson@cl.cam.ac.uk>
Cc: aron@hp.com, xen-devel@lists.xensource.com
Subject: Re: question regarding gnu-isms
Date: Thu, 27 Apr 2006 18:41:58 -0500	[thread overview]
Message-ID: <445156C6.6000507@us.ibm.com> (raw)
In-Reply-To: <200604280008.47804.mark.williamson@cl.cam.ac.uk>

Mark Williamson wrote:
> OK, now I'm curious too...
>
>   
>>> same file:
>>>
>>>     #define xen_create_contiguous_region(vstart, order, address_bits)
>>> ({0;})
>>>       
> <snip parts of explanation>
>   
>> But clearly you cannot use return for this (and you cannot avoid making
>> a statement here).  The GNU ({}) syntax allows you to have statements
>> within an expression and the value of the very last statement in the
>> block becomes the value of the expression.  The above could be written:
>>     
>
> But why do that, if you just wanted to return a constant?  why not 
>
> #define xen_create_contiguous_region(vstart, order, address_bits) 0
>
> for instance?
>   

I thought the same exact thing myself.  Of course, I can't find it in my 
tree (xen_create_contiguous_region is a function) so perhaps someone has 
already fixed it.

Regards,

Anthony Liguori

> Cheers,
> Mark
>
>   
>> #define min(a, b) ({int lhs = a; int rhs = b; (lhs < rhs) ? lhs : rhs;})
>>
>> All of these are documented in the GCC Info page (see the section on C
>> Extensions).
>>
>> Regards,
>>
>> Anthony Liguori
>>
>>     
>>>     This looks like the usual ({...}) construction but seems
>>>     pointless.  The nearest explanation I could gather for this
>>>     applies only to C++...  surely I'm missing something. :-)
>>>
>>> Thanks,
>>> Aron
>>>
>>> _______________________________________________
>>> Xen-devel mailing list
>>> Xen-devel@lists.xensource.com
>>> http://lists.xensource.com/xen-devel
>>>       
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>>     
>
>   

  reply	other threads:[~2006-04-27 23:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27 22:36 question regarding gnu-isms Aron Griffis
2006-04-27 23:04 ` Anthony Liguori
2006-04-27 23:08   ` Mark Williamson
2006-04-27 23:41     ` Anthony Liguori [this message]
2006-04-27 23:41       ` Mark Williamson
2006-04-27 23:16   ` Aron Griffis
2006-04-27 23:44     ` Anthony Liguori
2006-04-29  1:44       ` Aron Griffis
2006-04-28  5:09 ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=445156C6.6000507@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=aron@hp.com \
    --cc=mark.williamson@cl.cam.ac.uk \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.