badbytes.io

C++ Binary Internals

The idea for this post started out as an exploration of compiler optimizations in GCC. It turned into a static and dynamic C++ class exploration exercise. The piece of code we’ll look at:

// file: bin1.hpp
#include 
using namespace std;

class FirstClass
{
    public:
        FirstClass(int new_id) { id = new_id; };
        int get_id() const { return id; };
    private:
        int id;
};