Coding Conventions:

. Avoid global vars & provide getter/setter accessor functions.
. Avoid C++11 empty initializer lists. (PR #634)
This commit is contained in:
tomcw 2023-01-12 21:37:41 +00:00
parent 1902af4ad9
commit 0fe774dbdf

View File

@ -2,6 +2,9 @@ Coding Conventions for AppleWin
===============================
History:
v6 - 12-Jan-2023 (TC)
. Avoid global vars & provide getter/setter accessor functions.
. Avoid C++11 empty initializer lists. (PR#634)
v5 - 03-Apr-2022 (TC)
. #1072: Add a space after keywords.
v4 - 05-Mar-2022 (TC)
@ -130,6 +133,10 @@ EG:
Not:
for(int i=0; i<10; i++)
2.9: Avoid global variables.
If a free variable exists within a C++ file, then declare it static and provide getter & setter accessor functions.
-------------------------------------------------------------------------------
3) Use of sprintf() etc.
@ -151,6 +158,13 @@ Use type deduction only if it makes the code clearer to readers who aren't famil
or if it makes the code safer. Do not use it merely to avoid the inconvenience of writing an explicit type.
(Ref: https://google.github.io/styleguide/cppguide.html#Type_deduction)
4.2: Avoid C++11 empty initializer lists
This notation can be too obscure, compared to using regular initialization (for POD) or ctors (for classes).
EG, avoid this:
int var {};
struct s {};
-------------------------------------------------------------------------------
Appendix: Legacy Hungarian notation