似乎Delphi有时区分大小写-“替代方法应匹配祖先的大小写”。 [英] It seems that sometimes Delphi is case-sensitive - "override method should match case of ancestor"

查看:171
本文介绍了似乎Delphi有时区分大小写-“替代方法应匹配祖先的大小写”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我遇到了一个奇怪的提示:


覆盖方法xxxx应该与祖先yyyy的大小写匹配。


解决方案是声明方法名称与祖先完全相同。...我相信这是自Delphi.Net以来在编译器中保留的内容。编译器...



完全像祖先一样声明该方法,使编译器无声。

解决方案

在Delphi 2006及更高版本中还有其他区分大小写的提示/警告吗?与第三方代码协作时的代码。

此提示是在Delphi for .net中引入的,因为其他一些.net平台区分大小写。



请注意,该提示并不表示Delphi对此区分大小写。

仅在下面的第1点中,Delphi本身区分大小写,第2点是Delphi编译器在Windows API中调用区分大小写的函数 GetProcAddress()的方式的产物。 / p>

Delphi中区分大小写的行为



1-注册组件

我不知道其他任何区分大小写的提示,但是请注意,当您编写自己的组件并要注册它们时,声明的register函数必须这样写:

 程序寄存器; <<-所需的引导资金。 

如果不这样做,Delphi将不会添加新组件。



2-导入外部函数



如David所述,在导入外部函数时, DLL必须保留。



不能禁用单个提示

请注意,您不能禁用特定提示:可以禁用特定的Delphi提示吗?


Today I've encountered a 'strange' hint:

override method xxxx should match case of ancestor yyyy.

Solution was to declare the method name exactly as in the ancestor....I believe this is something which rested in the compiler since the Delphi.Net compiler...

Declaring the method exactly as in the ancestor made the compiler 'silent'. There are other 'case-sensitive' hints/warnings in Delphi 2006 and up?

解决方案

It's a hint that's in place to protect your code when cooperating with 3rd party code.
This hint was introduced with the addition of Delphi for .net, because some other .net platforms are case-sensitive.

Note that the hint does not imply any case sensitivety on Delphi's part.
Only in point 1 below is Delphi itself case sensitive, point 2 is an artifact of the way the Delphi compiler calls the case-sensitive function GetProcAddress() in the Windows API.

Case sensitive behavior in Delphi

1-Registering components
I don't know of any other hints that are case sensitive, but note that when you write your own components and you want to register them, the register function that you declare must be written like so:

procedure Register;  <<-- Leading capital required.  

If you don't Delphi will not add your new component.

2-Importing external functions

As stated by David, when importing external functions, the exact case used in the DLL must be preserved.

Individual hints cannot be disabled
Note that you cannot disable a specific hint: Can specific Delphi hints be disabled?

这篇关于似乎Delphi有时区分大小写-“替代方法应匹配祖先的大小写”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆