For documentation purpose I need to add some LaTeX equations in my C++ comments, by example:
//
// \begin{eqnarray*}
// y_1 &=& x_1 \\
// y_2 &=& x_2
// \end{eqnarray*}
//
int main() {}
With clang++ (version 9.0.1-10) I can compile my code without problem:
clang++ -Wall prog.cpp
but with g++ (version 9.2.1)
g++ -Wall prog.cpp
I get this warning:
prog.cpp:3:1: warning: multi-line comment [-Wcomment] 3 | // y_1 &=& x_1 \\ | ^
My question: which compiler is right? Can I legally use \\ inside C++ // comment?