Army1987 said:
If one is *really* that brain-dead, they could at least (apart from
not invading implementation namespace) add a {
Otherwise we would have
LOOP (42) {
stuff();
ENDLOOP
Nope. There is an opening { at the beginning of the LOOP macro.
This is why it's not really invading anyone's namespace, _nMax is a
local variable... granted, it could hide another _nMax which would be at
a higher level scope.
That said, there is a problem with this set of macros: only the first
instruction after the LOOP() will actually get looped.
You could add a { at the end of the LOOP() macro and add a second } at
the end of the ENDLOOP macro. There, better.
I agree that defining macros to do basic flow control is brain-dead, though.
That's not saying that you should never use macros. They are pretty
useful everytime they can spare you from repeating identical sequences:
it saves text space and keeps you (or at least lowers the probability
of) from doing evil copy-and-paste which can lead to silly errors.
They can make your source code look easier to read, too. And as an added
bonus, they can make maintaining much easier if your macros are well
written.