Prev (Commit Code) | Home | Manual | (Compile Instructions for Windows) Next
No one likes them but it helps to read and maintain the code. Thus please stick to them:
... if(item == nullptr) { return; } ...
int n; int maxBrownFoxes;
Use the Qt types (qreal, quint8, qint8, etc) exclusively, as all other definitions might not be portable.
Use the Qt wrappers for C/C++ API (qAbs(), qMin(), etc) exclusively as all other definitions might not be portable.
Classes start with a capital ‘C’
class CMyClass
class IItem { .... }; class CMyItemX : public IItem { // I think you get the idea. }
struct my_funny_data_t { .... };
enum my_enum_e { eMyEnumThing1 ,eMyEnumThing2 };
Use the override
keyword where ever appropriate. When using GCC 5.1 and more recent the compiler will throw a warning. This is important because it prevents us from producing some nasty bugs.
As we use the keyword override
we do not have to use virtual
, too. This is just redundant and of no real use anyway.
Use const
keyword on methods. Best practice is to use right on the spot for every method. And remove it the moment the method really alters the object’s data.
Use nullptr
for checking pointers against null, avoid using 0
or NULL
for pointers
I think that’s it. Just look at the code and try to mimic the coding style as good as you can. A bit of discipline really helps to maintain the beast.
Prev (Commit Code) | Home | Manual | (Compile Instructions for Windows) Next