Closed semiversus closed 6 years ago
“do { } while(false)” and “do {} while(0)” are very useful structures which have following benefits:
do {
if (
seems legit while development but I think it's cleaner without this construction. Is it OK for you to remove in a future point of time when things getting stable?
I reviewed the code segments you pointed out, all of these do {} while() structure have functionalities, so they cannot be removed. E.g.
The first three you mentioned are used for validation purpose (checking input variable conditions at runtime, even things getting stable, those validations are required for making code robust). The final one is used for limiting the life cycle of a local variable ‘chTempIndex’.
If you agree, I will remove those do {} while() structures which have no obviouse functionalities.
OK
I found some
do{ ... }while(false)
constructs in code. Are these left overs from former macro definitions or may I'm missing something?