News for hackers. Stuff that matters.
Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by CJefferson on Wednesday August 31, 2016 @08:16AM (#12397680)
My other personal feeling is that it's easy to auto-check we aren't using tabs (just search for tabs, and reject if any are found).

Depending on how you choose to format, it can be arbitrarily hard to check tabs are being used correctly.

For example, many people want to do some space indenting, such as:

    <tab>void my_function(int arg1, int arg2,
    <tab>                 int arg3)
    <tab><tab>{
It's (I believe) impossible for a language-agnostic tool to know this is "correctly tabbed", but (for example)

    <tab>void my_function(int arg1, int arg2,
    <tab>                 int arg3)
    <tab>    {
Is not.
Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by akerro on Wednesday August 31, 2016 @08:22AM (#12397712)
I just always enable "Show whitespaces" in any editor I use. https://i.stack.imgur.com/BP2WJ.png

This let's me know if I left any trailing tabs/spaces before committing, align code better and while writing not while "refactoring".

git commit -am 'Whitespace formatting changes only'

No.

Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by scrollaway on Wednesday August 31, 2016 @08:42AM (#12397836)
Don't align.

    void my_function(
        int arg1, int arg2, int arg3,
        ...
    ) {
Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by realharo on Wednesday August 31, 2016 @09:54AM (#12398283)
I also like a rule that states that you either put all the parameters on one line, or each one on its own separate line, but never something in between.
Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by exDM69 on Wednesday August 31, 2016 @10:15AM (#12398442)
I don't think blindly following any convention is good. Sometimes it makes sense to group a few parameters, take this toy example for instance:

    void drawrect(
        Surface *surf,
        int x, int y,
        int width, int height,
        uint32_t color);
Grouping relevant arguments just makes it a bit more legible. It's even more useful when calling the said function (assuming function with a lot of parameters, say XCreateWindow).
Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by CJefferson on Wednesday August 31, 2016 @09:53AM (#12398275)
While I quite like that style, now you have to convince people to never align, before you can convince them to use tabs.

I've not seen any large public code-bases uses this style, so it's hard to know how well it works in practice. Do you know of any major projects with a 'no alignment' requirement?

Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by MatmaRex on Wednesday August 31, 2016 @10:46AM (#12398691)
MediaWiki uses tabs for indentation and discourages alignment. https://www.mediawiki.org/wiki/Manual:Coding_conventions
Re:Tabs or spaces – Parsing a 1B files among 14 programming ... by hamax on Wednesday August 31, 2016 @08:46AM (#12397870)
I also much prefer this way of breaking long lines. Aligning parameters always looked ugly to me, specially with long function names.