Category: c++

forward declarations and ABI

This post argues the C++ rule: One should never forward declare a name from a 3rd party library This rule is a generalisation of the same rule for the standard library. The standard says [namespace.std]: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within . . .

link compatibility

A major source of errors among users of libtorrent has traditionally been caused by binary incompatibility between the (built) libtorrent library and the client linking against it. Binary- or link compatibility is having two sides of a shared library (or translation unit) boundary have different understandings about the layout of objects or calling conventions. Consider the following library interface: . . .

unsigned integers

In this post I will talk about the use of unsigned (integral) types in C++, or perhaps more specifically the rationale for using them. In my experience, it is common to use unsigned types for any variable holding a value that cannot be negative. Say, the number of bytes in a buffer.