if(foo)
I avoid doing this because it looks like a function call. if(foo)
I avoid doing this because it looks like a function call. #define if(X) LET(_it,X) if (_it)
it would be a macro call #define LET(name, X) \
for (int let_once_=1, name=(X); \
let_once_; \
let_once_=0)
may be reasonable, though tokenpasting in __LINE__ for good measure might be necessary for nesting. #define private public
#include "foo.cpp"
#undef private #define public protected #define else
#define struct union
Evil!> This is all very well if you have a friendly, high level scripting language like Ruby, but I'm definitely glad I don't have to write a C compiler where functions can take arbitrary blocks of code.
That's a surprisingly good setup because in Smalltalk(one of ruby's main ancestor languages)
if/else is a method which takes a block closure.
a ifTrue: [ l log: 'a is true'] ifFalse: [ 'a is false']
whilein ruby if else is a syntatic construct
if a
l.log ('a is true')
else
l.log ('a is false')
end
probably more for perceived clarity/comfortability then speeds sake.