为什么 `PURE` 定义 "confuse" Visual Studio 2015 Intellisense?

Why does the `PURE` define "confuse" Visual Studio 2015 Intellisense?

我注意到在函数前面指定一个空的 PURE 定义会混淆 VS2015 中的 Intellisense。同时,与其他非大写字母组合(purePurePurE)有效:

#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 不显示标记为 PURE 的函数的注释,并且在某些情况下(不确定是哪个,但是当函数位于单独的文件中时)"Go to Definition (F12)" 功能根本不起作用。如果我将 PURE 重命名为 Pure,它会起作用。

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

与此处正确的 Intellisense 工具提示相对:

顺便说一句,我之所以这样做是因为代码在 GCC 和 MSVC 之间共享,因此 PURE 在 GCC 中是 __attribute__((pure)),例如。所以现在看来​​我必须更改现有的 GCC 代码库才能在 Visual Studio 中使用 F12,除非我做错了什么。

这是某种预定义的宏,以某种方式干扰了 Intellisense 吗?

复制了你分享的代码,我在VS 2015和2017上测试了一下,发现VS 2017的结果可以弹出‘PURE’的注释,符合你的要求,请检查一下:

您可以尝试从Visual Studio Downloads or report this issue in VS 2015 to the VS Product Team at this page下载安装VS 2017寻求更专业的支持