C switch statement without braces

A example is static_assert.

 

 

#include <stdio.h>

#define static_assert(x)	switch (x) case 0: case (x):

int main(int argc, const char *argv[]) {

	static_assert(1 == 1);
	static_assert(1 == 2); // compile error

	int i = 10;
	switch (i) 
		printf("go\n");
}
  

Refer to http://stackoverflow.com/questions/8118009/is-there-a-useful-case-using-a-switch-statement-without-braces.

你可能感兴趣的:(statement)