Difference between _declspec and __declspec?

后端 未结 1 1103
借酒劲吻你
借酒劲吻你 2021-02-14 19:49

I sometimes see keywords starting with two underscores and other times just one. Is there any difference?

1条回答
  •  渐次进展
    2021-02-14 19:59

    I believe that _declspec is older name of the same Microsoft specific keyword __declspec. From a C++ Standard point of view, two underscores are more correct than a single underscore for an extension like this. That's according to 17.4.3.1.2/1:

    Certain sets of names and function signatures are always reserved to the implementation:

    • Each name that contains a double underscore (_ _) or begins with an underscore followed by an upper- case letter (2.11) is reserved to the implementation for any use.
    • Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.

    0 讨论(0)
提交回复
热议问题