Purpose of IF, ELSE, FOR macros ?
Posted
by psihodelia
on Stack Overflow
See other posts from Stack Overflow
or by psihodelia
Published on 2010-05-07T10:19:00Z
Indexed on
2010/05/07
10:28 UTC
Read the original article
Hit count: 193
I have a source code of a library which has a lot of strange IF, ELSE, FOR, etc. macros for all common C-keywords instead of using just usual if,else,for,while keywords. These macros are defined like this:
#define IF( a) if( increment_if(), a)
where increment_if() function is defined so:
static __inline void increment_if( void) {
// If the "IF" operator comes just after an "ELSE", its counter
// must not be incremented.
... //implementation
}
I don't really understand, what is the purpose of such macros? This library is for a real-time application and I suppose that using such macros must slow-down an application.
© Stack Overflow or respective owner