WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] question regarding gnu-isms

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] question regarding gnu-isms
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Fri, 28 Apr 2006 00:08:46 +0100
Cc: aron@xxxxxx
Delivery-date: Thu, 27 Apr 2006 16:10:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <44514DE1.3000201@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20060427223641.GG3572@xxxxxxxxxxxxxxx> <44514DE1.3000201@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.1
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?

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@xxxxxxxxxxxxxxxxxxx
> > http://lists.xensource.com/xen-devel
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

-- 
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel