diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 1f82c668e5..859e33a874 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