I need to migrate my C++ codes to Delphi. There are many checks to check if a given handle(HANDLE) is NULL or not in C++ codes. What is the equivalent constant that can be used in Delphi? It seems that null in Delphi is different from NULL in C++.
In the Windows C++ header files, NULL is a macro that expands to 0. This means that NULL can be used in both numeric and pointer contexts, because the C++ language supports such usage.
However, for Delphi, the value 0 is used in numeric contexts, and the value nil is used in pointer contexts.
Windows HANDLE values are declared in Delphi as numeric types and so in place of C++ NULL you should use 0 in Delphi.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With