C++ Logo


Advanced search

[wg14/wg21 liaison] P2264/N2829 make assert() macro user friendly was adopted for C23

From: Peter Sommerlad (C++) <"Peter>
Date: Thu, 17 Feb 2022 16:09:07 +0100

it would be great if the assert(...) changes proposed in P2264 could
also be adopted for C++23 as a kind of bug fix. The C people see it
verbally as a bug fix, because their assert() specification in the
non-NDEBUG case was not accepting all scalar expressions as specified.

How would we proceed for C++, if any?

There is a very simple change, almost editorially, if C++23 is based con
C23? Otherwise, it might be OK to wait until C++23.

The wording change is as follows:

In [cassert.syn] change the macro definition as follows:

-#define assert( E ) see below
+#define assert( ... ) see below

The contents are the same as the C standard library header <assert.h>,
except that a macro named static_assert is not defined.


Peter Sommerlad
Better Software: Consulting, Training, Reviews
Modern, Safe & Agile C++
+41 79 432 23 32

Received on 2022-02-17 15:09:11