Re: [gtk-list] Strange gcc behaviour



On Fri, Aug 07, 1998 at 03:41:04PM +0930, O'CONNOR, Steve wrote:
> just a quick one ...
> 
> why does this work ?
> 
> int a,b,c;
> 
> a = 56 + 3,
> b = 29 * 2,
> c = a * 2;
>

The comma operator separates related operations in a compact expression.  If
you were to write instead:

int a,b,c,d;

d = (a = 56 + 3,
b = 29 * 2,
c = a * 2);

The value of d would be 118 (a * 2) because the value of a comma separated
expression is the value of the rightmost expression.

Had to look it up,
James Gardiner

BTW, does this *really* belong on the GTK+ mailing list?  :)



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