开发者

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

开发者 https://www.devze.com 2023-04-12 23:25 出处:网络
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 i开发者_开

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 i开发者_开发百科s 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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号