]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - CODING_STYLE
cgroup: fix handling of TasksAccounting= property
[thirdparty/systemd.git] / CODING_STYLE
index 9dcc09030cfa7e1d72228b6a783c23749fe6668a..ae818126cb92218f0508da598a2410a36ec8c9dd 100644 (file)
@@ -1,9 +1,11 @@
 - 8ch indent, no tabs, except for files in man/ which are 2ch indent,
   and still no tabs
 
-- We prefer /* comments */ over // comments, please. This is not C++, after
-  all. (Yes we know that C99 supports both kinds of comments, but still,
-  please!)
+- We prefer /* comments */ over // comments in code you commit, please. This
+  way // comments are left for developers to use for local, temporary
+  commenting of code for debug purposes (i.e. uncommittable stuff), making such
+  comments easily discernable from explanatory, documenting code comments
+  (i.e. committable stuff).
 
 - Don't break code lines too eagerly. We do *not* force line breaks at
   80ch, all of today's screens should be much larger than that. But
   proper event, instead of doing time-based poll loops.
 
 - To determine the length of a constant string "foo", don't bother
-  with sizeof("foo")-1, please use strlen("foo") directly. gcc knows
-  strlen() anyway and turns it into a constant expression if possible.
+  with sizeof("foo")-1, please use STRLEN() instead.
 
 - If you want to concatenate two or more strings, consider using
   strjoin() rather than asprintf(), as the latter is a lot
   that interrupted system calls are automatically restarted, and we minimize
   hassles with handling EINTR (in particular as EINTR handling is pretty broken
   on Linux).
+
+- When applying C-style unescaping as well as specifier expansion on the same
+  string, always apply the C-style unescaping fist, followed by the specifier
+  expansion. When doing the reverse, make sure to escape '%' in specifier-style
+  first (i.e. '%' → '%%'), and then do C-style escaping where necessary.