do{...}while(0)

This often occurs in the macro definition syntax, the following effect:

1. Alternatively, when carrying out macro macro function to ensure that the form is not changed

 

2. In performing macro function to ensure a maximum run only once

 

3. avoid the use of the goto statement when writing to the internal logic. In the absence of reasonable and adequate consideration of the case try to avoid using the goto statement, likely to cause a variety of uncontrollable errors, but goto keyword is a good, very practical.

 

4.while (0) means that the program execution to jump out of here, so when writing programs consistent with normal logical thinking to write, you can avoid some of the grammatical errors that are difficult to avoid.

Guess you like

Origin www.cnblogs.com/still-smile/p/12035038.html