Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

10 Quick Hot Tips For Building A Modern C++ App

10 Quick Hot Tips For Building A Modern C++ App

When developing a C++ app with the use of Builder C++, these quick tips from Embarcadero C++ MVP Ylmaz Yörü will help you create truly useful and responsive UI designs for your users, as well as top-notch code to back up the functionality. Read on as you’ll learn the 10 quick hot tips when you are planning to build a modern c++ app.

1. You should use CLANG Standards in your C++ app code

10 Quick Tips About Building A C++ App. The C++ Builder Logo.

CLANG is considered to be a production-quality C, Objective-C, C++, and Objective-C++ compiler when targeting X86-32, X86-64, and ARM. It is a new C/C++ compiler standard (C++98, C++11, C++17, C++20, C++23 ..) supported by The LLVM Compiler Infrastructure Project, and has been a default compiler in recent years for most C/C++ compilers. This means that if you code for a CLANG compiler, most other IDEs, Compilers of Platforms will support your code without any changes. The latest C++17 standard is supported by most C++ compilers. More information about core language features can be found here. C++ 20 is new and needs adaptation time.

We highly recommend you start with or move to a CLANG-enhanced compiler like Embarcadero’s C++ Builder, which supports the CLANG (C++11, C++ 17) standard and has its own C++ Compiler, IDE, GUI Designer, and more. The C++Builder Standards and Clang-enhanced compiler features can be found here.

The C++ Builder Community Edition is a free edition and can be used by students, beginners, and startups.
You can download it here Free C++ Builder Community Edition.

Professional developers can use the Professional, Architect, or Enterprise versions of the C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.

CLANG is supported by many other Development IDEs like Visual Studio, VS Code, and Dev C++. CodeBlocks, CLion, etc. For more details, please see our article about the Top 6 C++ IDEs For Building Native Windows Apps.

2. Are you using predefined macros for more OS-friendly coding?

In C++ Builder, it is easy to check which OS Platform is compiling the code with Predefined Macros. Sometimes it is needed to understand the compilation platform during compile time or when you’re designing UI elements in accordance with the intended target platform. In this post we would like to give some examples to of which options to check in application code. The C++ compiler predefines certain global identifiers, known as ‘manifest constants’. Most global identifiers begin and end with __ (two underscores) in C++.

You can use predefined macros to check the platform’s operating system. There are CLANG Predefined Macros listed by LLVM.org here . Here below we listed some #if / #endif examples. Note that #definitions are parsed in compilation, 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 code are only compiled if it is compiled for windows. So by using these kind of Predefined Macros, all code will not be include in compilation that will let your compiled file size as much as small with predefinitions.

In some parts of your application, you may need to check the OS you are targeting. This may help you to develop a more OS-friendly application. You can write some specific lines or execution models between #if clauses with predefined macros. For example, you can check the target OS platform as below,

3. Simplify your C++ app user interface design

Every component, every text and how they are placed is really important for your users. Try not make your application complex with a lot of text, components and unnecessary things. Try to simplify the user interface as much as possible. Simplification helps user comprehension and usability.

4. Why you should void using menus and pop-up menus if it is a small C++ app

Menus and Pop-Up menus might be necessary for bigger applications. If you are developing a small application avoid using menus and pop-up menus unless they are absolutely necessary. Fewer buttons and more screens might be better for the overall user experience.

5. Are you grouping UI elements?

Use grouping UI elements to hold your items. In C++ Builder, every item can be used as a grouping element. For example, you can add an edit (TEdit) component to a label (TLabel) component. You can align the edit component to the right and you can align this label to its other group components.

In general, grouping components are Panel, GroupBox, Layout, Rectangle, and Toolbar. If you are developing an FMX application, use Layouts to group your items. Use them with Margins and Padding settings. Margins and Paddings set between 2px to 8px may be useful in most cases.

6. Do you always align your components?

The Align feature is one of the great features of C++ Builder in C++ app UI design. C++ Builder is very flexible and allows you to design any kind of application. The Align feature lets you develop ‘responsive’ application UI designs which adapt to different platforms and devices which may have quite varied screen resolution settings. A good responsive design will look ‘right’ even if the target device’s screen is at a much higher resolution than other devices.

7. You should check form size to recompose your UI Elements

If you are developing a C++ app for Windows check your Form size by using OnResize event as below,

You can also check for refresh by using OnPaint() event as below

You can hide or show some of your extra parts of your design.

8. How to check screen size in a C++ app to make the UI elements responsive

If you are developing a full screen application, use Screen to obtain a list of displays used to comprise the desktop, coordinates, dimensions, and other properties of displays. The DisplayCount property returns the number of displays and Displays provides an access to properties of all displays. See also Multiple Display Support

For example, we can get the size of the screen as shown below,

The user may use your application on machines with multiple displays. You can check the number of displays as below,

9. Check your C++ app’s screen orientation

If you are developing a mobile application, check your application’s screen orientation. Generally, orientation is described as Portrait or Landscape modes. Your application may have 4 different orientation types, these are.

PortraitiOS app displays in a vertical (portrait) orientation.
Upside downiOS app displays in a vertical orientation, but upside down, with the Home button on the top of the device instead of on the bottom.
Landscape home rightiOS app displays in a horizontal (landscape) orientation with the Home button on the right of the device.
Landscape home leftiOS app displays in a horizontal (landscape) orientation with the Home button on the left of the device.

In C++ Builder, you can easily check the current orientation mode of your running application. This helps you understand how the user is using the application. You can recompose/move/align UI elements or other elements in response to the screen’s orientation. Particularly with a mobile C++ app you can’t assume the screen will be landscape or portrait because users may hold their device in either orientation based on their personal preferences but also due to things like stands and cases which might impose a specific orientation due to their design.

10. You can easily and quickly enhance your application’s visual design by using styles

Styles are sets of graphical details that define the look and feel of an application visually and they are one of most beautiful and useful UI features of RAD Studio. Styles make your UI elements skinned with professionally designed styles. Official Styles are designed by Embarcadero’s Designers and other there are other 3rd party Styles. Users may also generate their own styles.


If you are developing a new C++ app, prefer to use the latest new components with new visuals. There is a fashion in programming when it comes to color and component choices, so the design is really important for an application. Because of this, try to use new components and modern visuals. Also prefer the newest Styles, for example, Windows 11 Styles in your application. These will make your applications look more modern and new.


You can download the free C++ Builder Community Edition here: https://www.embarcadero.com/products/cbuilder/starter.

Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit https://www.embarcadero.com/products/cbuilder.

Latest new posts, more examples, and tutorials can be found on blogs.embarcadero.com and in LearnCPlusPlus.org, you can easily improve your C++ programming knowledge and skills with those modern examples

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 33+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and other operating systems. He was born in 1974, Eskisehir-Turkey. He graduated from the Department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. One year later, he started to work in the same university as an assistant. He received his MSc and Ph.D. degrees from the same department of the same university. Since 2012, he is the founder and CEO of Esenja LLC Company. Some of his interests are Programming, Thermodynamics, Fluid Mechanics, and Artificial Intelligence. He also likes the graphical 2D & 3D design and high-end innovations. He has married, and he is a father of a son.
Related posts
C++IDERAD Studio

The Top 3 CLANG Based C++ IDE Choices Right Now


This Is How To Create And Run A Program In The C++ IDE


Is Windows App Studio Dead? What Is The Best Alternative?


10 Creative Ways To Develop Awesome C++ Apps On Windows

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.