
15 Jan
2013
15 Jan
'13
3:04 a.m.
2013/1/14 Vicente J. Botet Escriba <vicente.botet@wanadoo.fr>
Yeah. I was your macro forbid the access from outside the block. I though that the trick was used only to be able to add a label at the end of the block. But the use of the variable on the BREAK macro make it fail. Really clever.
#define BOOST_SCOPE(name) \ if (const bool LABELED_SCOPE_##name = false){BOOST_BREAK(name); name##_end_scope:;} else
#define BOOST_BREAK(name) \ (void)LABELED_SCOPE_##name; goto name##_end_scope
Modification: #define BOOST_BREAK(name) \ do {goto name##_end_scope;} while (LABELED_SCOPE_##name) This makes it a single stmt and the below should work: if (...) BOOST_BREAK(...);