I'm reading the Linux Kernel Coding Style, where Linus wrote something like this(Chapter 1 Indentation):

Don’t put multiple statements on a single line unless you have something to hide:

if (condition) do_this;


Outside of comments, documentation and except in Kconfig, spaces are never used for indentation, and the above example is deliberately broken.

  1. What does he mean by something to hide? Is it a sarcasm? cuz I don't see any point of coding in such format, not to mention hide something.

  2. And another question, what does

    the above example is deliberately broken.

    mean? Does it mean

    the above example is deliberately breaking this (no space) rule.

Thanks : )

closed as primarily opinion-based by Thomas Dickey, Archemar, Stephen Rauch, Stephen Kitt, Rui F Ribeiro Aug 11 '17 at 18:30

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  1. Such coding style makes it easy to misinterpret what the code is supposed to do. In the example, due indention and having another statement the same row, one might mistakenly think that do_something_everytime is in if block and executed only if condition is true. Instead the if block only contains do_this and do_something_everytime is always run.

    This kinds of "malicious" indention has caused bugs in software in past, for example a famous bug in Apple's TLS certificate verification affecting Safari and possibly other Apple software.

  2. The example is also breaking no space rule as explicitly stated by explanation.

  • But why unless? I mean, under no circumstance should a programmer write like that, right? Or is playing 'malicious' tricks like this one of geeks' fun in Linus's age? – Cedric Sun Aug 11 '17 at 10:32
  • 2
    I quite certain its sarcasm; hiding what code does doesn't improve readability which is usually desired and you probably shouldn't be hiding anything in publicly available source code anyways. So yes, you shouldn't under any circumstances write code like that. – sebasth Aug 11 '17 at 10:37
  • @Cedric It means "unless your intent is actually malicious and you do not want to be spotted easily". – xhienne Aug 11 '17 at 12:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.