Posts Tagged compile

C++ For C# Developers: Part 35 – Modules, The New Build Model

Tags: , , , ,

We’ve already seen C++’s traditional build model based on #include. Today we’ll look at the all-new build model introduced in C++20. This is built on “modules” and is much more analogous to the C# build model. Read on to learn how to use it by itself and in combination with #include!

Read the rest of this article »

2 Comments

C++ For C# Developers: Part 24 – Preprocessor

Tags: , ,

C# and C++ have similar lists of preprocessor directives like #if, but their features and usage are very different. This is especially the case in C++ with support for “macros” that can replace code. Today we’ll look into everything we can use the preprocessor for in C++ and compare with C#’s preprocessor.

Read the rest of this article »

4 Comments

C++ For C# Developers: Part 5 – Build Model

Tags: , , ,

Today’s article continues the series by introducing C++’s build model, which is very different from C#. We’ll go into preprocessing, compiling, linking, header files, the one definition rule, and many other aspects of how our source code gets built into an executable.

Read the rest of this article »

10 Comments

C++ Scripting: Part 6 – Building the C++ Plugin

Tags: , , , ,

Today we’ll continue the series by addressing a nagging problem: how do we build the C++ plugin? With C# we inherit, for better or worse, Unity’s build system where we just edit .cs files and press the play button. This doesn’t work with C++, so we’ll need to build something similar that’s just as easy to use.

Read the rest of this article »

3 Comments

Compile Time Only

Tags: , , , , , ,

The const and final keywords only apply at compile time. Despite having written about const and final before, readers frequently ask me about these two keywords. Today’s article will answer the question and definitively show that these keywords only apply at compile time: not runtime. UPDATE: const is still just a variable as far as performance goes, but its protections do extend to runtime.

Read the rest of this article »

13 Comments

Conditional Compilation

Tags: , ,

MXMLC’s -define feature allows you to do two things: compile-time constants (as covered previously) and conditional compilation. Both are very useful, so today I’m covering conditional compilation.

Read the rest of this article »

10 Comments