On 01/10/2011 08:13, Mattias Gaertner wrote:
On Sat, 1 Oct 2011 10:08:59 +0300
Zaher Dirkey<[email protected]>  wrote:

Off your topic
On Sat, Oct 1, 2011 at 9:53 AM, Mattias Gaertner
<[email protected]>wrote:

"Assigned" is used instead of "FOnClick<>nil"

What is different between check the Method fields ?
"Assigned(FOnClick)" and "FOnClick<>nil"
http://wiki.lazarus.freepascal.org/IDE_tricks#Events_.28Method_properties.29_in_the_Object_Inspector


Strange, on the page it says:
if  OnMyEvent<>  nil  then  OnMyEvent(...);// wrong, because it checks Data too

if  OnMyEvent = NewValuethen  exit;// wrong, because it compares only Code

So I compiled (to assembler)  32 bit:

Comparison with nil (expect to check code + data, as told above)
Comparison with other method (expect code only)

But in both cases it tests one long entry (testl or cmpll). so the same amount of data. It doesn't look that <> nil checks code+data?

# [33] if OnDeactivate <> nil then;
    movl    -8(%ebp),%eax
    movl    980(%eax),%eax
    testl    %eax,%eax
.Lj6:
.Ll3:
# [34] if OnClose = nil then;
    movl    -8(%ebp),%eax
    movl    956(%eax),%eax
    testl    %eax,%eax
.Lj8:
.Ll4:
# [35] if OnDeactivate = OnCreate then;
    movl    -8(%ebp),%eax
    movl    -8(%ebp),%edx
    movl    980(%eax),%eax
    cmpl    972(%edx),%eax


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to