C++ Logo

faq-discussion

Advanced search

[FAQ-DISCUSSION] FW: [editors:3022] Fwd: isocpp.org Question/Comment

From: Herb Sutter <hsutter_at_[hidden]>
Date: Mon, 20 May 2019 21:58:30 +0000
to FAQ editors…


---------- Forwarded message ---------
From: Benjamin Golinvaux <benjamin_at_[hidden]<mailto:benjamin_at_[hidden]>>
Date: Mon, May 20, 2019 at 7:26 AM
Subject: isocpp.org<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fisocpp.org&data=02%7C01%7Chsutter%40microsoft.com%7C581e5aed73dc4b0f8b9408d6dd63362e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636939815568755534&sdata=Rq%2BItX9rC8VIcJWXc6RlMAuBjih9Chpc9Cz3eIDsEPA%3D&reserved=0> Question/Comment
To: <admin_at_isocpp.org<mailto:admin_at_[hidden]>>


Hello

In the
https://isocpp.org/wiki/faq/misc-technical-issues#macros-with-multi-stmts<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fisocpp.org%2Fwiki%2Ffaq%2Fmisc-technical-issues%23macros-with-multi-stmts&data=02%7C01%7Chsutter%40microsoft.com%7C581e5aed73dc4b0f8b9408d6dd63362e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636939815568755534&sdata=RBH%2BP16cUhO10Xh9yp626whDdSzAR3USI96WS2Q4Rq8%3D&reserved=0>
page, in my humble opinion, there shouldn't be a newline between "else" and
"(void)0" or a backslash ("") is missing after else:

#define MYMACRO(a, b)
 if (true) {
 statement1;
 statement2;
 /*...*/
 statementN;
 } else
 (void)0
 â†‘ // Intentionally not adding a ; here!

This is a problem because it may puzzle beginners trying to use this very
clever trick. I remember it being correct in the original C++ Faq lite, but
this could be a fictional memory :)

Best,

Benjamin
--
You received this message because you are subscribed to the Google Groups "Editors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to editors+unsubscribe_at_[hidden]<mailto:editors+unsubscribe_at_[hidden]>.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/editors/CAAwV4_mxBH7FBD6M1NWC5f47YLq1g3%2B09BqNFGKJO9DsynFwZg%40mail.gmail.com<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fa%2Fisocpp.org%2Fd%2Fmsgid%2Feditors%2FCAAwV4_mxBH7FBD6M1NWC5f47YLq1g3%252B09BqNFGKJO9DsynFwZg%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Chsutter%40microsoft.com%7C581e5aed73dc4b0f8b9408d6dd63362e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636939815568765522&sdata=7jFEgnS3D3xwWOM7eNqq6n%2FvKZS0r90MLk2bsjAExDc%3D&reserved=0>.

Received on 2019-05-20 17:00:42