From 1e2d8682cb9eec160fa9def1b8434a9d385f0d88 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sat, 5 Sep 2015 11:47:29 +1000 Subject: [PATCH] Document intent --- qcsrc/common/util-post.qh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/util-post.qh b/qcsrc/common/util-post.qh index dd20cf8f5..f796b6ebd 100644 --- a/qcsrc/common/util-post.qh +++ b/qcsrc/common/util-post.qh @@ -3,12 +3,15 @@ [[alias("self")]] entity __self; -#define WITH(type, name, value, block) do { \ +// Can't wrap with do-while as block may contain continue or break +#define WITH(type, name, value, block) { \ type __with_save = (name); \ name = (value); \ LAMBDA(block) \ name = __with_save; \ -} while (0) +} do { } while (0) + +// Transition from global 'self' to local 'this' // Step 1: auto oldself #if 1 @@ -33,6 +36,7 @@ entity getself() { return self; } #endif // Step 4: enable when possible +// TODO: Remove SELFPARAM in favor of a parameter #if 0 #define SELFPARAM() noref const entity this = __self #define self this -- 2.39.2