代码之家  ›  专栏  ›  技术社区  ›  Lou

为什么“纯”定义“混淆”Visual Studio 2015 Intellisense?

  •  1
  • Lou  · 技术社区  · 9 年前

    我注意到指定一个空 PURE pure , Pure , PurE

    #include <stdint.h>
    
    #define SOME
    #define PURE
    #define Pure
    #define STUFF
    
    // upper case "PURE" 
    SOME PURE STUFF uint8_t Add(uint8_t a, uint8_t b)
    {
        return (uint8_t)(a + b);
    }
    
    // pascal case "Pure"
    SOME Pure STUFF uint8_t Sub(uint8_t a, uint8_t b)
    {
        return (uint8_t)(a - b);
    }
    

    结果表明,Intellisense不会显示标记为的函数的注释 纯净的 ,在某些情况下(不确定是哪个,但当函数位于单独的文件中时),“Go to Definition(F12)”函数根本不起作用。如果我重命名 纯净的 纯净的 ,它有效。

    请注意此处的无注释工具提示:

    Specifying PURE confuses VS

    Other macros work fine

    顺便说一句,我之所以这么做是因为代码是在GCC和MSVC之间共享的,所以 __attribute__((pure))

    1 回复  |  直到 9 年前
        1
  •  1
  •   Sara Liu - MSFT    9 年前

    复制了您的共享代码,我在VS 2015和2017中进行了测试,我发现VS 2017中的结果可以弹出符合您要求的纯评论,请检查: enter image description here

    Visual Studio Downloads 或者在VS 2015中向VS产品团队报告此问题,网址为 this page