3 ms·
At least in my opinion, "for loop initial declaration" is especially useful in macros (although many programs will never need such macros, they are especially u
by zzo38computer 2y ago
At least in my opinion, "for loop initial declaration" is especially useful in macros (although many programs will never need such macros, they are especially useful when you do have them).
An example of such a macro is the following macro (the loop and the variable declaration will both be optimized out by the compiler; I have tested this):
#define lpt_document() for(int lpt_document_=lpt_begin();lpt_document_;lpt_document_=(lpt_end(),0))
Another macro (which is a part of a immediate mode UI implementation) is:
#define win_form(xxx) for(win_memo win_mem=win_begin_();;win_step_(&win_mem,xxx))