编译器错误显示“ pi”符号

我在 科利鲁上测试一些代码,得到了一个奇怪的输出。我把代码写下来,可以用这个简单的 一段代码代码复制它:

int main()
{
π
}

G + + 的输出:

output on g++

叮当声:

output on clang

例如,只使用 pi(没有地址 -of)显示预期的结果:

main.cpp:3:5: error: 'pi' was not declared in this scope
pi;
^

我尝试在我的机器上使用 g + + 4.9.2和其他站点上重现这个过程,但是我做不到。

这是这个网站上的一些错误,这些编译器的一些配置?

为什么只使用地址操作符(&)显示这个符号?

3576 次浏览

It's a bug on the site, as the compiler's output is not properly escaped. The compiler should output π, but that's valid HTML, producing the pi symbol you see.

π is html code for π. It looks like someone forgot to escape things properly.