C++ Logo

sg16

Advanced search

Re: [isocpp-sg16] Thoughts on P4235R0: Removing Digraphs

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Tue, 29 Sep 2026 10:31:25 +0200
On 9/28/26 23:01, Tom Honermann via SG16 wrote:
> I don't think trigraphs can ever be a conforming extension. The following example has well-defined behavior in ISO C++, but behaves differently when trigraphs are enabled. https://godbolt.org/z/o3xznsrGY.
>
> #include <cstdio>
> int main() {
> std::printf("It's like magic: '??!'\n");
> }

The model is that trigraphs are mapped in phase 1 (which is implementation-defined),
and the implementation is simply considered to use a (rather strange) source file
encoding. Which is conforming.

Whether that kind of allowance jeopardizes the portability promises of C++
is another question.

Jens

Received on 2026-09-29 08:31:30