Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 5 Apr 2015 19:02:10 +0300
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: Coding Style

On Sun, Apr 05, 2015 at 03:22:47PM +0200, magnum wrote:
> On 2015-04-05 14:04, Solar Designer wrote:
> > I use 8 char tabs, and I like them.  In early 1990s, I used to prefer
> > indentation with a few spaces (2 or 3), but later I realized that if I
> > need so many indentation levels that 8 char tabs start being a problem
> > (push lines beyond 80 chars), this usually means that the code needs to
> > be refactored (usually split into more functions).
> 
> I can relate to that and for core this is a good decision. But in Jumbo
> we live with lots of external things: Macros like
> CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR and functions like
> clCreateProgramWithBinary(). Not to mention AMD's ADL. We get crazy long
> lines without writing code that should be split to more functions.
> Actually for OpenCL host code I often just give up and let it span
> several lines.

OK, I see the problem.  I think moving away from 8 char tabs is the
worst solution.  I think it's better to allow for lines longer than 80
chars in jumbo (perhaps 132), or to use spaces only (no tabs at all).

8 char tabs are the default in many places, including e.g. when I view
text files with "less" or john-dev postings in "mutt", or when my web
browser renders a <pre>...</pre> block or a text/plain web page (perhaps
from CVSweb or GitHub).

If you use tabs only, then non-standard tab width is acceptable.
If you use tab to indent, space to align - as you wanted to - then
non-standard tab width is unacceptable.  This gives us another option:
switch to non-standard tab width, but give up on using space to align.

> > 8 char tabs are used in Linux kernel, and in many *BSD's KNL
> > http://en.wikipedia.org/wiki/Kernel_Normal_Form
> 
> They also decide their name space. We can't.
> 
> Also, no matter what you and I say or want, virtually everyone that
> contributes to Jumbo DO use 4 or smaller, and I'd rather not complain
> too much about it (risking just ending up with less contributions). If
> we say 4, we might get away with enforcing it.

If you insist on this, then please ensure there won't be any use of
space characters (simply don't align things at all).  Tabs only.  Then I
will be able to simply use a wider terminal window and not care what tab
width others editing the file meant to use.  Since this effectively
exceeds 80 chars anyway, I don't see much difference between this option
and simply allowing e.g. 132 chars, except that this option forbids use
of spaces and any kind of alignment.  Maybe that's good.

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.