diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 081d793360ed712d72305fe81b8bd536d87d628c..1f82c668e52807b32ed20e7a5c4a4f4af37f77ee 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -826,6 +826,28 @@ } +
For readability reasons new code should avoid shortening comparisons + to 0 for numeric types. Boolean and pointer comparisions may be + shortened. All long forms are okay: +
++ virFooPtr foos = NULL; + size nfoos = 0; + bool hasFoos = false; + +GOOD: + if (!foos) + if (!hasFoos) + if (nfoos == 0) + if (foos == NULL) + if (hasFoos == true) + +BAD: + if (!nfoos) + if (nfoos) ++
Macros defined with an ALL_CAPS name should generally be