My whitespace style

David Kelly dkelly at hiwaay.net
Tue Apr 14 18:02:04 PDT 2009


On Apr 14, 2009, at 6:24 PM, deeptech71 at gmail.com wrote:

> David Kelly wrote:
>> On Mon, Apr 13, 2009 at 10:46:26AM +0200, deeptech71 at gmail.com wrote:
>>> Tabs are better, because they allow the programmer to specify the
>>> desired width, and is dynamically changable at any time.
>> Spaces are better because they let the author specify the  
>> formatting and
>> not left to some other re-interpretation.
>
> And indeed they should used where formatting is important. However,  
> C/C++ indentation is not of this nature.


It is if you want your comments to stay lined up, and code remain  
readable.

There are many sections of code I write C in *columns*, especially  
when making repetitive calls to the same function with different  
arguments. I make the arguments line up in a column. printf() is a  
common example, that I want the arguments to line up no matter it has  
no effect on the output. I indent for readability and the result  
almost never survives variable tab interpretation.

If I write the code and indent 3 or 4 or 8 spaces then by golly thats  
the way it should remain. If there is a project format spec then it  
should be written in .indent.pro and I will use it and make sure my  
code is readable after a pass through indent(1). This notion of tabs  
as a flexible indent is flawed.

--
David Kelly N4HHE, dkelly at HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.



More information about the freebsd-chat mailing list