Is there any difference between If Assigned(Foo)
and If (Foo <> nil)
? If So, when should they each be used?
相关问题
- Do the Java Integer and Double objects have unnece
- Is there a Delphi 5 component that can handle .png
- What means in Dart static type and why it differs
- Is there a way to install Delphi 2010 on Windows 2
- Is TWebBrowser dependant on IE version?
相关文章
- What exactly do pointers store? (C++)
- Notice: Undefined property - how do I avoid that m
- Which is faster, pointer access or reference acces
- Best way to implement MVVM bindings (View <-> V
- Immutable value as inout argument
- Windows EventLog: How fast are operations with it?
- How to force Delphi compiler to display all hints
- Coloring cell background on firemonkey stringgrid
It is almost the same thing. The official documentation states
So, if
P
is an ordinary pointer, thenP <> nil
andAssigned(P)
are exactly equivalent. On the other hand, ifP
is some procedure, thenwill work, as will
but
will not even compile. Hence, the conclusion is that
P <> nil
andAssigned(P)
are exactly equivalent every time both works!