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
*
* 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))