Archiv der Kategorie: C++

Fast way to return a large object

Within this article I want to think about the question how we can move objects between different scopes without the need of expensive copying and without the need to use an error-prone pointer handling. To analyze this topic, we want … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Type Safety and Resource Safety in C++

If I should summarize the main advantages of C++ in one short sentence I would say: C++ is a completely type safe and resource safe language without performance loss. The type- and resource safety are two very powerful features if … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Arrays and inheritance, a source of errors

If you work with arrays of objects and offer some functions to execute on these arrays, it is common to pass an array pointer and the array size as function parameters. Arrays will often hold a huge amount of data. … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Exception-safe code

During the last years the manner we handle exceptions has fundamentally changed. If we look few years back we will find a lot of applications with exception handling in bigger context only. For example, a module executing a bigger task … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Pure Interfaces

In my opinion, one disadvantage of c++ is that there exists no explicit interface concept or language feature. Of course, you can implement interfaces in c++ but you must use an abstract. The downside of this concept is the fact … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Casting in C++, Part 2

Within the first part of the article we have seen the existing type of casts and we have analyzed the c++ style operators for static cast and dynamic cast. We will now continue with the const cast and reinterpret cast … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen

Casting in C++, Part 1

The rules of C++ are designed to guarantee that type errors are impossible. Unfortunately, casts subvert the type system. That can lead to all kinds of trouble. Casting is a fundamental concept but it should be used with caution. A … Weiterlesen

Veröffentlicht unter C++ | Kommentar hinterlassen