Is there a use case for such a macro, or is it just a puzzle for its own sake?
https://github.com/JacksonAllan/CC/blob/42a7d810274a698dff87...
Specifically, if (arg)==(arg) is not a constant expression, then it could have side effects.
However, this mechanism does generate some annoying false positives, as shown below:
// Create a map with int keys and values that are vectors of floats:
map( int, vec( float ) ) our_map;
init( &our_map );
// Create a vector of floats:
vec( float ) our_vec;
init( &our_vec );
push( &our_vec, 1.23f );
// Insert the vector into the map.
insert( &our_map, 456, our_vec );
// Generates a warning because get checks its first argument for side
// effects and the compiler can't tell that the first argument of the
// outermost get has none:
printf( "%f", *get( get( &our_map, 456 ), 0 ) );
// The "proper", albeit cumbersome, way to achieve the same thing without a
// warning:
vec( float ) *itr = get( &our_map, 456 );
printf( "%f", *get( itr, 0 ) );