From c2cf6b7ade4f244a31b83030856b0502ec90db9e Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 9 Nov 2011 21:38:39 +0000 Subject: [PATCH] Correct a comment. I had wrongly believed my TYPECHECK macro double-evaluated one of its arguments and hence would cause side effects to happen twice. But in fact I've just realised that although it double-_expands_ the argument, it doesn't double-_evaluate_ it: the two expansions occur in mutually exclusive branches of a ?:, and hence cannot both be executed. So I've removed the comment that says my macro is rubbish. My macro is in fact great :-) git-svn-id: svn://svn.tartarus.org/sgt/charset@9328 cda61777-01e9-0310-a592-d414129be87e --- iso2022.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/iso2022.c b/iso2022.c index 56c4b1d..6e527dd 100644 --- a/iso2022.c +++ b/iso2022.c @@ -81,8 +81,7 @@ typedef int (*to_dbcs_planar_t)(long int, int *, int *, int *); * * We are permitted to use ?:, however, and that works quite well * since the actual result of the sizeof expression _is_ evaluable - * at compile time. So here's my final answer, with the unfortunate - * remaining problem of evaluating its arguments multiple times: + * at compile time. So here's my final answer: */ #define TYPECHECK(x,y) ( sizeof((x)) == sizeof((x)) ? (y) : (y) ) #define DEPLANARISE(x) TYPECHECK((x) == (to_dbcs_planar_t)NULL, (to_dbcs_t)(x)) -- 2.11.0