Site icon Learn C++

Quickly Learn To Check OS Platform Compiled In C++ Builder With Predefined Macros

Sometimes it is needed to understand compilation platform during compile or acting and designing UI elements in accordance with the platform. In this post we would like to give some examples to check some options in application codes. The C++ compiler predefines certain global identifiers, known as manifest constants. Most global identifiers begin and end with __ (two underscores) in C++.

C++ Builder is the easiest and fastest C & C++ IDE for developing simple or professional applications on Windows, MacOS, iOS and Android operating systems. C++Builder has both CLANG Enhanced C/C++ Compiler and it’s new Borland C/C++ Compiler. It is also easy for beginners to learn with its wide range of samples, tutorials, help files and LSP support. C++ Builder comes with Rapid Application Development Studio, also knowns as RAD Studio, and C++ Builder is one of the most professional IDEs that work under RAD Studio. It also features a modern, high-productivity RAD Studio IDE, debugger tools, and enterprise connectivity for to accelerate cross-platform UI development. You can develop GUI based applications easily, as it comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs. There is a free C++ Builder Community Edition that can be used by students, beginners and startups with limitations.

You can download Free the C++ Builder Community Edition (CE) here: https://www.embarcadero.com/products/cbuilder/starter. Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. You can download and use the trial version for one month with the same capabilities as the full version . Please visit https://www.embarcadero.com/products/cbuilder.

To understand compile platform you can use Predefined Macros to check platform operating system. All these macros are listed here. There are CLANG Predefined Macros listed by LLVM.org here . Here below we listed some #if / #endif examples. Note that #definitions are cared in completion, so if something is not related with under this #if clauses it is not compiled. For example if you check your application is for Windows or not, your Windows specific codes are only compiled if it is compiled for windows. So by using these kind of Predefined Macros, all codes will not be include in compilation that will let your compiled file size as much as small with predefinitions.

Checking OS Platform

[crayon-6622867e2394c453784890/]

Checking Compilation if it is compiled with BCC or CLANG Compiler

[crayon-6622867e23957883301104/]

Checking Compilation if it is C only or C++

[crayon-6622867e2395b353745337/]

Checking Compilation if it is for 32bit or 64bit Windows ( Inline usage)

[crayon-6622867e2395d141505884/]

Checking ARM Platform if it is 32bit or 64bit

[crayon-6622867e2395e652414220/]

Please see full list of Predefined Macros to examine more options about OS & Compiler based options.

Exit mobile version