[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnubg] Coding Styles - Indentation / Tabs / Spaces

From: Thomas A. Moulton
Subject: Re: [Bug-gnubg] Coding Styles - Indentation / Tabs / Spaces
Date: Sat, 27 Oct 2012 08:12:21 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20120925 Icedove/3.0.11

I am not a heavy contributor, but I've been a C programmer for long time...

Yes the long 'discussion' of spaces vs tabs...

tabs - you can set the tab stops to 2, 4 or 8 and everyone sees what they like...
But that was also a good one when your choice in editor were 2: vi or vi

Yes 4 generally good, I have one project where they use 3, drives me nuts

Yes minimal blank lines and { on the same line as the control statement,
unless you are making an extra block for local variables.

gotta save those trees and use the minimal number of punch cards...

On 10/26/2012 09:00 PM, Michael Petch wrote:
On 2012-10-26 18:37, Joseph Heled wrote:

I am in favour of
   -- uniform style in a project
If I was the lone person on my own project I would have globally
reformatted everything and put it away already. I agree, having
everything in one format would be nice. And then suggest it as the
coding style for our project for the code contributors.

   -- not mixing tabs and spaces. I would say use spaces only.
Yes, this is often a debate in itself. I have no problem with all
spaces. Many of the modern editors support the conversion of a hard tab
into spaces. The advantage is that you can read it even in editors that
can't have the tab width adjusted and it still looks correct. I don't
think extra file size is as much of a concern. I don't know how many are
saving it onto punchcards ;-), nor is it destined for webpages.

   -- reasonably cramming as much code into HxW as possible : my
eyesight forces me to relatively large font, even on a large screen.
      So I *hate* lines with a single curly (wasting the most precious
resource, vertical lines). I also prefer 2 spaces indentation - could
probably live with 4.

So curly braces on control statements would help. And you'd probably
prefer to have blank lines minimized (These options exist in the
automatic code formatters as well)

Regarding tabs I'm not a personal fan of two, and I think 8 is too many
for our project given the indentation depth of some of our functionss. I
will point out that the Google c-style is a tab width of 2, so it does
have a following. I have to throw my hat into the ring and say I have a
personal preference of 4. I do use 8 on my own projects, but I wouldn't
suggest it here.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]