c++visual-c++visual-studio-2019trigraphs

Trigraphs not compiling with MS compiler?


I have a C++14 project withe the Microsoft compiler in Visual Studio 2019 and I'm trying to understand Digraphs and Trigraphs, so my code is a bit weird:

#include "Trigraphs.h"

void Trigraphs::assert_graphs()
??<
    // How does this ever compile ????/
    ouch!
??>

Reading about the /Zc:trigraphs switch

Through C++14, trigraphs are supported as in C. The C++17 standard removes trigraphs from the C++ language.

I understand that trigraphs should be supported until C++14 because they were removed in C++17 only. Yet, the above code does not compile with C++14 settings until I add the additional command line switch. I am not a native English speaker, did I get something wrong about the sentence that trigraphs are supported until C++14?


Solution

  • MSDN also says:

    The /Zc:trigraphs option is off by default

    and that seems to apply for C++14 already. Although that results in a non 100% conformant C++ compilation, most programmers will actually prefer not dealing with the strange symbols of C++ trigraphs.