From: Tim Streater on
On 27/02/2010 08:32, Ben Finney wrote:
> Tim Streater<timstreater(a)waitrose.com> writes:
>
>> Trouble with tabs is, what is a tab?
>
> <URL:http://www.jwz.org/doc/tabs-vs-spaces.html>
> <URL:http://c2.com/cgi/wiki?TabsVersusSpaces>
> <URL:http://www.codinghorror.com/blog/archives/001254.html>

Thanks, but I'm busy doing nothing this morning and so don't have time
to read all that.

--
Tim

"That the freedom of speech and debates or proceedings in Parliament
ought not to be impeached or questioned in any court or place out of
Parliament"

Bill of Rights 1689
From: Lorenzo Villari on
On Fri, 26 Feb 2010 23:32:05 -0600
Kelsey Bjarnason <kbjarnason(a)gmail.com> wrote:

>
> Because spaces, for purposes of indentation, are defective by design,
> and editors are generally built in such a manner as to use the right
> thing for the right job. Spaces between words, etc, tabs for
> indentation.
>

And someone prefer to use spaces instead of tabs. Then there's python
if one loves tabs so much to indent everything. Happy tabbing :)
From: Casper H.S. Dik on
ike(a)localhost.claranet.nl (Ike Naar) writes:

>Then, it's not always black and white.
>Consider the case where a condition does not fit on a single line:

> if (sscanf(input_buffer, "%d %d %d", &length, &width, &height) == 3 &&
> sscanf(other_buffer, "%d %d %d", &color, &price, &weight) == 3 &&
> needs_processing(color)) {
> compute_volume(length, width, height);
> compute_something_else(price, weight);
> }

>vs.

> if (sscanf(input_buffer, "%d %d %d", &length, &width, &height) == 3 &&
> sscanf(other_buffer, "%d %d %d", &color, &price, &weight) == 3 &&
> needs_processing(color))
> {
> compute_volume(length, width, height);
> compute_something_else(price, weight);
> }

>In the first case, it is hard to see where the condition ends
>and where the body starts. In the second case it's obvious.
>Don't you think that the opening brace on its own line here improves
>the readability?

I call a strawman; a proper c-style will not allow the first form;
e.g., at Sun our style requires this form:

if (sscanf(input_buffer, "%d %d %d", &length, &width, &height) == 3 &&
sscanf(other_buffer, "%d %d %d", &color, &price, &weight) == 3 &&
needs_processing(color)) {
compute_volume(length, width, height);
compute_something_else(price, weight);
}


It's clear what the condition is and where the body starts.

Things I absolutely hate in some c-styles are:


if(condition)


"if" is a not a *function* it shouldn't look like one.

cstyles which require additional parantheses

if ((sscanf(input_buffer, "%d %d %d", &length, &width, &height) == 3) &&
(sscanf(other_buffer, "%d %d %d", &color, &price, &weight) == 3) &&


Some C code looks like as if it is written with a leaking fountain pen
on smudged and crumpled paper.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
From: Casper H.S. Dik on
Kelsey Bjarnason <kbjarnason(a)gmail.com> writes:

>On Fri, 26 Feb 2010 11:28:19 -0800, Keith Thompson wrote:

>> Richard Heathfield <rjh(a)see.sig.invalid> writes:
>>> Tim Streater wrote:
>>> <snip>
>>>
>>>> Trouble with tabs is, what is a tab?
>>>
>>> A quick way of inserting exactly two spaces into the source.
>>
>> The One True Tabstop Width is 8.

>Three, actually. Okay, 8, if you're stuck using output devices from the
>1960's which didn't allow user-defined tab spaces, but for how many
>people is this true anymore?

You don't quite understand why a ne True Tabstop Width is 8?

It is because *other* *people* want to look at your code.

If you file contains real tabstops they better make sure that the file
looks right when displayed with a standard terminal.

>Now imagine if they were using spaces. This guy uses two, the next guy
>uses three, the third guy uses 4, the fourth guy uses 5, some other guy
>uses 8.

>With tabs, at least just by setting your tab stops, you can get a degree
>of consistency. Have fun sorting out the nightmare of inconsistency
>spaces lead to.

No, because you make the file non-portable, unless you save with
spaces and not with tabstops.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
From: Nick Keighley on
On 27 Feb, 13:56, Casper H.S. Dik <Casper....(a)Sun.COM> wrote:
> i...(a)localhost.claranet.nl (Ike Naar) writes:

> Things I absolutely hate in some c-styles are:
>
>         if(condition)
>
> "if" is a not a *function* it shouldn't look like one.

I write it like this

if (condition)
some_func (x);

and 'if' still doesn't look like a function to me



First  |  Prev  |  Next  |  Last
Pages: 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Prev: integer
Next: shared memory question