diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 1f82c668e52807b32ed20e7a5c4a4f4af37f77ee..859e33a874f2f2d84d9374ecf88370ff4c2a62e0 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -847,6 +847,17 @@ BAD: if (!nfoos) if (nfoos) +

New code should avoid the ternary operator as much as possible. + Specifically it must never span more than one line or nest: +

+
+BAD:
+    char *foo = baz ?
+                virDoSomethingReallyComplex(driver, vm, something, baz->foo) :
+                NULL;
+
+    char *foo = bar ? bar->baz ? bar->baz->foo : "nobaz" : "nobar";
+

Preprocessor