User Tools

Site Tools


best_practices

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
best_practices [2016/03/12 11:19] jmgrbest_practices [2023/04/25 16:52] (current) – external edit 127.0.0.1
Line 5: Line 5:
 ==== Tips & tricks ==== ==== Tips & tricks ====
  
-=== Always initialise primitive variables (other types do not require this) ===+=== Always initialize primitive variables (other types do not require this) ===
  
 <code cpp> <code cpp>
Line 14: Line 14:
 // Good // Good
 int myVariable{}; int myVariable{};
-std::string myString; // std::string is not a primitive variable, so initialisation is optional+std::string myString; // std::string is not a primitive variable, so initialization is optional
 </code> </code>
  
Line 183: Line 183:
 </code> </code>
  
-=== When using events, prefer using lambdas (nameless functions) instead of static functions ===+=== When using events, prefer using lambdas (anonymous functions) instead of static functions ===
  
 <code cpp> <code cpp>
Line 335: Line 335:
 </code> </code>
  
-When dealing with QObject-based classes you should use qobject_cast.+When dealing with QObject-based classes you should use [[http://doc.qt.io/qt-5/qobject.html#qobject_cast|qobject_cast]].
  
 === Header files should not depend on other #includes === === Header files should not depend on other #includes ===
best_practices.1457781544.txt.gz · Last modified: 2023/04/25 16:52 (external edit)