Is compiler directive WIN32 and CPUX86, WIN64 and CPUX64 interchangeable in Delphi?
If yes, Which one is preferred? If no, why?
Whether or not they are interchangeable depends on platforms you are developing for.
Generally, if you are doing only Windows development then they are interchangeable, otherwise not.
WIN32
is defined only for Windows 32bit platform, and WIN64
is defined only for Windows 64bit platform.
However, CPUX86
is defined for several platforms: Windows 32bit, OSX 32bit, and iOS 32bit simulator.
Right now WIN64
and CPUX64
are only defined for Windows 64bit platform, so at the moment they are interchangeable, but that may change in the future.
Which directive you should use depends on your code. Use directive that conveys proper meaning. If part of code is meant only to run on Windows 32bit platform then use WIN32
directive, if it is meant to run on any platform but under 32bit x86 processor then you should use CPUX86
.
Predefined Conditionals
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