I've just been shown a very neat C trick:
int myInt = ( { int x=42; x; } ); // sets myInt to 42
This is very useful for writing macros. But what exactly is going on here? Could someone pick this line apart and isolate/identify the mechanisms?
I've just been shown a very neat C trick:
int myInt = ( { int x=42; x; } ); // sets myInt to 42
This is very useful for writing macros. But what exactly is going on here? Could someone pick this line apart and isolate/identify the mechanisms?
It's the same as int myInt = 42;
. Just initializing with an expression whose value comes from x which has been initialized by 42.