It seems that sometimes Delphi is case-sensitive - “override method should match case of ancestor”

给你一囗甜甜゛ 提交于 2020-01-13 08:52:08

问题


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?


回答1:


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?



来源:https://stackoverflow.com/questions/7754701/it-seems-that-sometimes-delphi-is-case-sensitive-override-method-should-match

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!