C++ Logo

std-proposals

Advanced search

Re: [std-proposals] condexpr: new syntax for preprocessor conditional inclusion

From: Peter Olsson <dataapa_at_[hidden]>
Date: Tue, 13 Dec 2022 08:21:35 +0100
> condexpr if (ABCD)

Is this equivalent to `#ifdef ABCD` or `#if ABCD` ?

>The syntax looks more like standard C++ code and less like preprocessor directives

Is this an advantage or a disadvantage?

If I understand your proposal correctly, it's still a preprocessor
directive but it disguises itself as normal C++ code. Preprocessor
code and normal C++ code are essentially two independent languages.
The way it works at the moment is that the preprocessor runs first
(without it having to care about scopes or other C++ rules). The
actual C++ code is not parsed until after the preprocessor has
finished. Since they are so different I wonder if it's not a good
thing that they have different syntax.

Received on 2022-12-13 07:21:48