C switch statement without braces

665 단어 statement
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
"); }
  
Refer to  http://stackoverflow.com/questions/8118009/is-there-a-useful-case-using-a-switch-statement-without-braces .

좋은 웹페이지 즐겨찾기