I'm trying to figure out whether C++ is a suitable language for use in device drivers, like peripherals on Cortex-M3/M4.

I started writing some drivers for GPIO and I noticed that it produces bigger assembly. I'm doing some experiments on <https://godbolt.org/>.

A piece of code that executes an action on a GPIO peripheral and set a specific pin as high would look like this:

```
void gpio_set_high(int x)
{
    (base + x) |= 1;
}

```

In C++ that would be done like this:

```
class GPIO
{
public:
    GPIO(int x)
    {
        pin = x;
    }

    void setHigh()
    {
        (base + pin) |= 1;
    }

private:
    int pin;
};

```

First the question is, why does the class produces bigger assembly?