将“Ex”添加到函数/方法名称中意味着什么?
我不太使用 Windows API,但我见过它在其中使用,并且偶尔在工作中的代码库中使用过。
I don't work with the Windows API much, but I've seen it used there as well as occasionally in a codebase here at work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,他们想要改进(扩展)API 并保留相似的名称,这样程序员很可能会转向新版本。
值得注意的是 GetVersionEx() 用于获取 Windows 版本,这在一段时间内是一个令人讨厌的先有鸡还是先有蛋的问题,非常痛苦。
记录保持者是国家语言支持团队,他们有多个 ExEx 版本,例如 EnumCalendarInfoExEx。毫不奇怪,文化的发展速度比软件还要快。目前还没有ExExEx。
Yup, they wanted to improve (Extend) the API and keep a similar name so it was likely that the programmer would move to the new version.
Notable is GetVersionEx() to get the Windows version, pretty painful for a while with a nasty chicken-and-egg problem.
The record keeper is the National Language Support team who have several ExEx versions, like EnumCalendarInfoExEx. Unsurprising, culture moves even faster than software. No ExExEx as of yet.
它通常是在不破坏现有客户端代码的情况下更改 API 中函数的参数的一种方式。旧代码可以继续使用以前的版本,而新代码可以利用Ex版本提供的新功能。
It's usually done as a way of changing the parameters to a function in an API without breaking existing client code. Old code can continue to use the previous version, while new code can take advantage of the new features offered by the Ex version.
这是一种命名约定,仅表明该函数是原始函数的扩展版本。
It's a naming convention that simply indicates the function is an extended version of an original.
不确定,但我猜它代表扩展。
Not sure but I guess it stands for extended.