Skip to main content


Placement new operator

Posted in

void *buf = reinterpret_cast<void*>(0xf01f);
X *x = new (buf) X;

Corrupted reference

Posted in

One of the things that differs a reference from a pointer is the fact that any reference MUST be initialized (just like constants). One might think that this guarantees safe usage of references.

Return const reference

Posted in

class Q
        Q() { x = 7;}
        int& getX() { return x; }
        int x;

Syndicate content