Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

 

In looking at the following macro, can anyone explain the purpose of the "do" loop. From what I can tell, it executes only once so is it really needed ?
  IQI_RELEASEIF(p) do { if (p) { IQI_Release((IQI*)(p)); p = 0; } } while (0)

 

here is a good post to understand, why this kind of syntax is used:-
 
http://www.rtems.com/ml/rtems-users/2001/august/msg00086.html
or
http://bytes.com/topic/c/answers/219859-do-while-0-macro-substitutions
or google for "do while 0 macro".

here is a good post to understand, why this kind of syntax is used:-
 
http://www.rtems.com/ml/rtems-users/2001/august/msg00086.html
or
http://bytes.com/topic/c/answers/219859-do-while-0-macro-substitutions
or google for "do while 0 macro".