zoukankan      html  css  js  c++  java
  • Compiler showing 'pi' symbol on error

    Question:

    I was testing some code on Coliru, and I got a strange output. I went down the code and could reproduce it with this simple piece of code:

    int main()
    {
        π
    }

    The output on g++:

    output on g++

    clang:

    output on clang

    For instance, using just pi (without the address-of) shows the expected result:

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

    I tried to reproduce this on my machine, using g++ 4.9.2 and on others sites but I could not.

    Is this some bug on this site, some config of these compilers ?

    And why only using the address-of operator (&) shows this symbol ?


    Answer:

    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.

    想要看到更多学习笔记、考试复习资料、面试准备资料? 想要看到IBM工作时期的技术积累和国外初创公司的经验总结? 敬请关注: [CSDN](https://blog.csdn.net/u013152895) [简书](https://www.jianshu.com/u/594a3de3852d) [博客园](https://www.cnblogs.com/vigorz/) [51Testing](http://www.51testing.com/?15263728)
  • 相关阅读:
    .globl分析
    ARM汇编指令
    汇编文件后缀.s与.S
    Uboot命令
    BIOS、BootLoader、uboot对比
    汇编的WEAK关键字
    USB OTG
    前端学习笔记——CSS选择器
    前端学习笔记——HTML
    【1】python模块:自定义模块的3种导入方式
  • 原文地址:https://www.cnblogs.com/vigorz/p/10499215.html
Copyright © 2011-2022 走看看