Rico's Nerd Cluster

「离开世界之前 一切都是过程」

GDB, DDD (Data Display Debugger)

GDB for ROS, Core Dump

Introduction GDB is EXTREMELY handy. I used to doing a lot of print statements, but now I use GDB a lot. The reason is simple: I can check multiple things at once without recompiling everytime, es...

C++ - [Compilation 5] Compilation Speed Ups

Header-only Library Hurts Compilation Time My halo library takes ~2-3min to compile. I have ~20 executables, each executable does target_include_files(70_header_files). Why It’s Slow Every tr...

C++ - [Compilation 4] Name Mangling

nm

Motivating Example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 void foo(){ const size_t N = 100'000'000; std::vector<int> v(N); // fill v with 1,2,3,... std::...

C++ - [Compilation 3] Linkage

In C++, Linkage is Either External Or Internal

Linkage In C and C++, linkage determines the accessibility of functions & variables defined in one source file in other different translation units (i.e., different source files). There are t...

C++ - [Compilation 2] Compiler Directives

Macros, Pragmas, Attributes

Introduction Compiler directives are instructions that are not part of C++ / C standards, but tell the compiler how to compile the code. They starts with # (pronounced as “hash”), and are handled ...

C++ - [Compilation 1] Compilation Model

Header Files, Translation Unit, One Definition Rule (ODR), Compiler Optimization, Compiler, ELF

Compilation Model Creating an executable from a single, small source file is conceptually straightforward: 1 source file -> file_to_binary -> executable However, when a project consists o...

C++ - ABI Compatibility

ABI Compatibility: Introduction and Motivating Example ABI stands for Application Binary Interface. Two versions of the same library might be API-Compatible (you can recompile your code), but they...

C++ - [Pointers - 1] - Raw Pointer

Raw Pointers, Array, Casting

Raw Pointers 🚀 Basics new and delete: If you use new, you must use delete — otherwise, memory leak! see code. new[]:size must be provided as part of the signatu...

C++ - Namespace

Anonymous Namespace

C++ Anonymous Namespaces: The Modern Way to Hide File-Local Code In C and C++, it is common to write helper functions or file-local variables that should only be used inside a single source file. ...

C++ - Pimpl Idiom

Minimal Structure 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 // header // Widget.hpp #pragma once #include <memory> class Widget { public: Widget(); ~Widget(); void doSomething...