[fpc-devel] Types.IntersectRect(), probably bug or misusage VERY URGENT
Sergei Gorelkin
sergei_gorelkin at mail.ru
Tue Oct 26 16:57:37 CEST 2010
Jonas Maebe пишет:
>> With a little testing, here are two facts:
>> 1) Delphi 7 also shows this bug.
>> 2) Windows.IntersectRect() does not show it, allowing 'misuses'.
>>
>> So, whoever wrote the FPC function, must have been trying really hard
>> to achieve bug-to-bug compatibility with Delphi... or simply copied
>> their buggy code.
>
> Not necessarily. It's probably a consequence of the person not seeing a
> reason for first doing everything in a temporary variable and then
> copying this temporary variable to the destination. Unless you
> consciously think about the fact that const parameters may be passed by
> reference, it's easy to make such "mistakes" (although technically, they
> are not mistakes, but they do make it easier for people using such a
> function to make error).
>
Well, maybe. For me, it is rather hard to think about the opposite - that a const may be passed
*not* by reference - due to long-term Delphi/Windows experience.
But, after all, Types.IntersectRect and surrounding stuff were introduced and are intended as WinApi
replacement, and WinApi IntersectRect() *does* pass params by reference (they are originally PRect).
So maybe it will be still good to fix Types.IntersectRect to conform?
Regards,
Sergei
More information about the fpc-devel
mailing list