Windows API 函数名称中的“Ex”代表什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4039054/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does "Ex" stand for in Windows API function names?
提问by Maxim Gershkovich
In windows APIs and various other libraries where I have seen multiple entry points to methods I have noticed the use of the Ex abbreviation in scenarios such as MyApiCall and MyApiCallEx.
在 windows API 和其他各种库中,我看到了方法的多个入口点,我注意到在 MyApiCall 和 MyApiCallEx 等场景中使用了 Ex 缩写。
My assumption is that this stands for Extension or Extra could someone please confirm?
我的假设是这代表扩展或额外有人可以确认吗?
Any history on why Ex was chosen rather then MyApiCall2 or similar would also be appreciated.
任何关于为什么选择 Ex 而不是 MyApiCall2 或类似的历史也将不胜感激。
采纳答案by ssube
I was under the impression it stood for extended, as in a more detailed interface for that particular library.
我的印象是它代表扩展,就像该特定库的更详细的界面一样。
For example, CreateFile with 4 parameters is the typical version and CreateFileEx with 17 is the version offering more control and finer detail over how the file is opened, what occurs if it doesn't exist, etc, and is thus extended.
例如,带有 4 个参数的 CreateFile 是典型版本,带有 17 个参数的 CreateFileEx 是提供更多控制和更精细细节的版本,包括文件打开方式、文件不存在时发生的情况等,因此得到扩展。
回答by user2092506
When Microsoft updates a function and the new function is incompatible with the old one, Microsoft continues to support the old function. The new function keeps the same name as the old function, with added -Ex suffix.
当微软更新一项功能,而新功能与旧功能不兼容时,微软会继续支持旧功能。新函数与旧函数保持相同的名称,但添加了 -Ex 后缀。