4 ms·
Two space indentation is fairly common in C code bases. GNU projects use a kind of hybrid indentation where child statement are indented by two spaces, but if
by kazinator 2y ago
Two space indentation is fairly common in C code bases.
GNU projects use a kind of hybrid indentation where child statement are indented by two spaces, but if they are compound statements the indent their interior by another two spaces:
if (proprietary(program))
roll_on_floor_twitching(stallman);
else
{
calm_down(stallman);
make_indent_weirdly(stallman, everyone);
}
Google’s style guides for various "C likes" also recommend two space tabs.
"Use only spaces, and indent 2 spaces at a time." [Google C++ Style Guide, https://google.github.io/styleguide/cppguide.html https://google.github.io/styleguide/cppguide.html]
If you've been staring at Linux kernel code for weeks, with its 8 space tabs, and the edit two-space-tab code, it will take getting used to at first. The indentation will seem small. Soon, it will expand in your mind's eye and look large.
- davidw 2y agoJust because it's not uncommon doesn't mean it is not wrong, though! And it's still easier to see in C code than something with a bunch of angly parenthesis.
- deleted 2y ago[deleted]