Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is compiler directive WIN32 and CPUX86, WIN64 and CPUX64 interchangeable in Delphi?

Is compiler directive WIN32 and CPUX86, WIN64 and CPUX64 interchangeable in Delphi?

If yes, Which one is preferred? If no, why?

like image 411
justyy Avatar asked Nov 07 '15 12:11

justyy


1 Answers

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

like image 197
Dalija Prasnikar Avatar answered Nov 14 '22 15:11

Dalija Prasnikar