I want to invoke multi-line macro in circulation to break/continue it.
If I use “do{…}while(0)” in multi-line macro definition, break/continue is only effect on “do {…}while(0)”, not the circulation who invoke this macro. So I consider using “if(1){…}” in multi-macro definition.
#define EXIT_CIRCULATION() \
if(1){ \
break; \
}
void func(){
while(1){
...
EXIT_CIRCULATION();
...
}
}
But I doubt wheather it is a good way to use “if(1){…}” in macro definition, because I can not find any example in internet.
Thanks!
if you code something like
then the expansion of your macro won’t behave as you intuitively expect. The
elsewould apply to yourif (1)and will never happen.