C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Preprocessor multi-line macroes

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Thu, 25 Jun 2026 00:38:47 +0200
On 6/25/26 00:11, Halalaluyafail3 via Std-Proposals wrote:
> On Wed, Jun 24, 2026 at 5:44 PM Jens Maurer via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
>>
>>
>> Did you run this past WG14? What's their interest?
>
> This looks very similar to N3531. It looks like that was dropped though.

Indeed, that looks very similar to WG14 N3531:

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3531.txt

Hm...

https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3815.htm

says

"Scheduled for Spring 2026:

    Colomar, Add directives #def and ​#enddef (updates N3524) [N3531] (0.5 hours)"

but it doesn't appear here:

https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3814.htm
https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3815.htm

So maybe it was accidentally dropped. I'd suggest to contact the
author of WG14 N3531 and find out what happeend.

Jens



>> On 6/24/26 23:33, Frederick Virchanza Gotham via Std-Proposals wrote:
>>> Instead of doing this:
>>>
>>> #define ASSERT_EQ(a, b) \
>>> do \
>>> { \
>>> if ( (a) == (b) ) break; \
>>> \
>>> std::fprintf(stderr, #a " != " #b " at %s:%d\n", \
>>> __FILE__, __LINE__); \
>>> std::abort(); \
>>> } while (0)
>>>
>>> Wouldn't it be nice to be able to do this:
>>>
>>> #define ASSERT_EQ(a, b) \\\
>>> do
>>> {
>>> if ( (a) == (b) ) break;
>>>
>>> std::fprintf(stderr, #a " != " #b " at %s:%d\n",
>>> __FILE__, __LINE__);
>>> std::abort();
>>> } while (0)
>>> \\\
>>>
>>> I'm told back in the 1990's, a guy called Andrew Myers made a patch
>>> for GNU gcc so that you could do:
>>>
>>> #begin define swap(x,y,T)
>>> do {
>>> T temp = x;
>>> x = y;
>>> y = temp;
>>> } while (0)
>>> #end
>>>
>>> Whether we use three backslashes or "'#begin define", this should be
>>> standardised in C++29.
>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2026-06-24 22:38:51