C++ Adventures: `const madness`

It’s been an incredibly productive week for me in terms of soaking myself in C++ dark holy waters. I gave up on the idea of having “well-written” C++ in the sense that I don’t think I can get this right this year. I need to read a LOT of code before I can get the gist of writing C++ in an acceptable manner.

By what measure would it be acceptable? Obviously not by internet “standards”, at the very least I want to feel peace of mind that I’m not creating a tiny little black holes every time I compile an application.

const X* p means “p points to an X that is const”: the X object can’t be changed via p.

X* const p means “p is a const pointer to an X that is non-const”: you can’t change the pointer p itself, but you can change the X object via p.

const X* const p means “p is a const pointer to an X that is const”: you can’t change the pointer p itself, nor can you change the X object via p.

At my stage, I shouldn’t worry about things like these right now as I’m not building a library or complex code that requires that. However, I can’t really turn an eye on it and pretend it doesn’t exist either.

Thus, for me this issue would be best to attend to as it happen.

In the meantime, I’ve been working my brains off studying Qt Framework which I believe will really help me in the future. I finally feel comfortable working with it even though what I write in C++ feels incredibly messy.