[wp-hackers] Coding style

ravi gadfly at exitleft.org
Tue Jul 4 13:30:28 GMT 2006


At around 4/7/06 8:23 am, Elliotte Harold wrote:
> 
> The problem is not that applications handle tabs incorrectly. It's that
> they handle tabs differently. In practice tab lengths range from 1 to 12
> spaces. Moving from one computer, editor, or printer to another can
> completely change the layout of the code.
>

Elliotte,

the rendering of tabs and print output are performed by an editor and
some application (such as 'enscript', or the editor itself) for
printing, yes? All that is required, it seems to me, is agreement on
what tab width should be. Any decently sophisticated editor should
provide a mechanism for specifying the tab width. I know 'vi' (vim) and
'emacs' do ('vim' and perhaps even 'emacs' provide a way to even specify
within the file what the tabwidth is, though I am not quite happy with
cluttering code with these sort of directives). Being a Unix-head I am
not sure about the constraints on PocketPC etc, but the previous poster
seems to indicate he has no trouble.

I think there are some good arguments in favour of spaces (and also that
variable use of tab width per developer is not really an advantage with
tabs, since code formatted for tabwidth=4 looks horrible at tabwidth=2),
but I also believe there are some advantages to tabs (one example I
mentioned earlier is the ease of reformatting -- which I admit can be
made somewhat moot by a bit of complex editor configuration).

Also, I hope the powers are lenient about use of the following brace style:

    if ( cond )
    {
        ... statements ...
    }

Will stop extending this thread upon being scolded! ;-)

	--ravi

-- 
Support something better than yourself: ;-)
PeTA:       http://www.peta.org/
GreenPeace: http://www.greenpeace.org/


More information about the wp-hackers mailing list