Tab Setting in Coding Guideline

Hi,

When I was reading the Coding Guideline of Haiku I was quite confused about the following one:

  • Set your editor to 4 spaces per tab. (This is the standard used for the line-limit and for alignment [e.g. in class definitions], but if you aren’t doing either of these things you can set your editor to whatever you want. )

While I was browsing some source code (e.g. src/add-ons/kernel/network/protocols/ipv4) and Gerrit (e.g. this merged patch, it seems 8 spaces per tab is always used. Therefore, which one should I use if I want to contribute to Haiku?

Thank you

As it’s a preference of your editor (or in fact your Gerrit settings, check it’s 4 there), it’s almost a matter of personal taste. As long as everyone uses tabs in the code, people are free to ‘render’ it in their editor/browser as they like.
Where it does play a role - as stated in your quote - is when it comes to line-breaking to not exceed the 100 chars/line limit. People using 8 instead of 4 spaces/tab reach the 100 chars limit sooner when things get indented.

So… set to 4 and you’re good.

1 Like

Oh I see. I was quite confused at the first sight. It’s clear now, thank you.