oscillator

  • Thread starter Bill Cunningham
  • Start date
R

Richard

Nick Keighley said:
I'm with you here. Why type it wrong then indent it? Why not do
it right in the first place?

If anyone says that they are either more of a beginner than you or have
never programmed C in industry.

Do NOT leave white space like that.

The code should be

    fp=fopen("file","wb");

The grip WAS about braces and multiple statements on one line. You would
know that if you READ what is being said to you

I think this just demonstrates that different people have different
opinons.
I find the compressed version hard to read (do you have a whitespace
shortage where you work?). For the record I am not a beginner and I
have
programmed C in industry.

I use ws like this

fp = fopen ("file", "wb");

I accept

fp = fopen("file", "wb");

stuff[*] like this

fp=fopen("file","wb");

That would never have passed any code reviews on code bases I have
worked. Consistency is the god. And we always settled on minimum padding
"in statement".

But as I said before, all to their own. I just highly recommend against
it. C's syntax is there for a reason and I do not need white spaces to
spot a bracket or a comma.
 
B

Ben Bacarisse

Richard said:
You are exaggerating the case. I pointed out earlier that its not the
end of the world.

I have however taught a lot of graduates into big code bases. I do know
what I am talking about. Excessive white space is never, ever the case
in C. In *any* of hundreds, of programs I have worked on.

And you exaggerate mine. You argued for:

fp=fopen("file","wb");

which is a spacing convention I have never seen anyone advocate
before. Do you insist on on it in your projects? All I did
was ask for "space around operators and after a comma". That is in
no way "excessive space". I'd say it was the norm.
*snip*

I know. This is why I want him to MANUALLY INDENT and NOT use
indent.

I think you missed the point, but since it is off-topic, lets just
agree to disagree on that part.
 
S

santosh

Richard said:
Nick Keighley said:
On 10 Jun, 03:53, Richard<[email protected]> wrote:
Do NOT leave white space like that.

The code should be

fp=fopen("file","wb");
I think this just demonstrates that different people have different
opinons.
I find the compressed version hard to read (do you have a whitespace
shortage where you work?). For the record I am not a beginner and I
have programmed C in industry.

I use ws like this

fp = fopen ("file", "wb");

I accept

fp = fopen("file", "wb");

stuff[*] like this

fp=fopen("file","wb");

That would never have passed any code reviews on code bases I have
worked. Consistency is the god. And we always settled on minimum
padding "in statement".

But as I said before, all to their own. I just highly recommend
against it. C's syntax is there for a reason and I do not need white
spaces to spot a bracket or a comma.

So why do we have whitespace around punctuation in natural English? And
if one doesn't need whitespace within a statement, then presumably you
don't need whitespace between statements too.

Here is a typical excerpt from K&R2:

if (c == ' ' || c == '\n' || c == '\t')
state = OUT;

Presumably that will not pass your code reviews and the following
version of it will?

if(c==' '||c=='\n'||c=='\t')state=OUT;
 
S

santosh

Don said:
I'll second that "argue". STRONGLY. The other alternative

fp = fopen( "file" , "wb" );

is *JUST BARELY* tolerable, IMO. At the very least, have the decency
to stick the comma up tight against the end of "file"!

However, as far as I'm concerned

fp = fopen ( "file" , "wb" );

or any variant that puts a space between the fopen and its left paren,
REGARDLESS OF HOW SYNTACTICALLY LEGAL IT MIGHT BE, is justification
for whacking the perpetrator upside the head no less than 3, but no
more than 7 times with whatever blunt implement happens to be within
easy reach and not nailed down.

What about?

fp = fopen ( "file" , "wb" ) ;

:)

At least it has a certain symmetry, similar to Richard's version.
 
R

Richard

Ben Bacarisse said:
And you exaggerate mine. You argued for:

fp=fopen("file","wb");

which is a spacing convention I have never seen anyone advocate
before. Do you insist on on it in your projects? All I did
was ask for "space around operators and after a comma". That is in
no way "excessive space". I'd say it was the norm.

I already mentioned that the spaces around the = are not big deal.
I think you missed the point, but since it is off-topic, lets just
agree to disagree on that part.

I didn't miss any point. We can agree to disagree on small variations in
white space. I am adamant that whatever he chooses he must do manually.
I am also adamant that white space everywhere like in the paremeter list
is messy and unnecessary.
 
R

Richard

Richard Heathfield said:
santosh said:


Presumably for the same reason that we argue with trolls. I've caught a
little of the Cunningham/Riley exchanges through quotes, and I can't help
finding it mildly bemusing that a troll is complaining about another
troll's trolling.

Riley's position on whitespace (if my third-hand understanding is correct -
basically, he seems to believe that anyone with at least as much C
knowledge as Bill Cunningham will squeeze every last optional space out of
every statement) is of course an utterly ludicrous position, but then
we're accustomed to trolls taking up ludicrous positions, are we not?

<snip>

You're being purposely obstructive and ridiculous. Nothing knew then
from Heathfield.

My point is that Bill needs to manually indent.

Not rocket science.

The reasons are well documented in the thread.
 
R

Richard

santosh said:
What about?

fp = fopen ( "file" , "wb" ) ;

:)

At least it has a certain symmetry, similar to Richard's version.

I could *live* with this monstrosity. But this is not the point. Bill
was convinced that it was his white space in just an expression which
was the problem. It wasn't. The REAL problem was his layout with
braces. It was horrible. And someone, wrongly in my opinion, told him to
use "indent".

He should do it himself and learn by doing. Only a brick could fail to
realise the importance of properly indented code after a short while.

I suspect some self important jobsworth like Heathfield will quibble
over some minor language point here, but its as clear as the chip on his
shoulder what I mean here.
 
A

Antoninus Twink

On 10 Jun 2008 at 13:00, Richard Heathfield wrote:
[snip inaccurate caricature of Richard R's position]
is of course an utterly ludicrous position, but then we're accustomed
to trolls taking up ludicrous positions, are we not?

For someone who claims that C doesn't have global variables, that C
doesn't have a call stack, that C doesn't support multidimensional
arrays, and that RJH doesn't have a personal vendetta against Jacob
Navia, to then accuse others of "taking up ludicrous positions" really
takes the biscuit.
 
B

Ben Bacarisse

Richard said:
Ben Bacarisse <[email protected]> writes:

I didn't miss any point. We can agree to disagree on small variations in
white space. I am adamant that whatever he chooses he must do
manually.

My point was (now long clipped by you) that he can't do it manually.
Telling him to is like telling someone with severe dyslexia to spell
manually and not use a spell-checker.

Now, I may be wrong about both the facts of this case or the general
idea that layout follows from understanding, but you did miss the
point in that you addressed neither of these. You just repeated your
instruction to do it manually.
 
R

Richard

Ben Bacarisse said:
My point was (now long clipped by you) that he can't do it manually.

But he must force himself to learn how to do it. using indent is clearly
no solution.
Telling him to is like telling someone with severe dyslexia to spell
manually and not use a spell-checker.

Bah. I do not believe that for a moment.
Now, I may be wrong about both the facts of this case or the general
idea that layout follows from understanding, but you did miss the
point in that you addressed neither of these. You just repeated your

I missed nothing. I pointed out some common layout rules and told him to
use them with manual indenting. It is not rocket science. He can only
understand the code if it is properly, cleanly and consistently laid
out. When opening a brace even Bill can surely learn to hit return and
tab in?
instruction to do it manually.

And I do again now.

I do not believe for one minute he is incapable of indenting code
correctly - whichever style he goes for.

I am more and more convinced he is trolling to be honest.
 
S

santosh

Richard said:
I could *live* with this monstrosity. But this is not the point. Bill
was convinced that it was his white space in just an expression which
was the problem. It wasn't.

Then why did you tell him categorically to remove whitespace within a
statement?
The REAL problem was his layout with
braces. It was horrible. And someone, wrongly in my opinion, told him
to use "indent".

He was told by several posters to use indent to format his code only
after tedious and protracted replies on manually formatting code, all
of which he simply could not follow. Time after time he was shown the
common formatting styles and told to pick one and be consistent, but of
course, he didn't (couldn't?). That was the point when several posters,
fed up, told him to at least run his code through indent before posting
to this group, so that he could at least get the help of one or two
sympathetic souls.
He should do it himself and learn by doing.

The problem is, at Bill's rate of learning, we could be endlessly stuck
teaching him code layout. Obviously many posters consider Bill's actual
C questions a bit more tolerable than his problems with whitespace. So
they told him to use indent and be done with it.
Only a brick could fail to
realise the importance of properly indented code after a short while.

Surprisingly Bill's code formatting _has_ improved after he was told
about indent. Maybe we should just leave matter as they are? After all,
the more things he can do with automated help, the easier it will be
with all of us. :)

<snip>
 
B

Ben Bacarisse

Richard said:
But he must force himself to learn how to do it. using indent is clearly
no solution.


Bah. I do not believe that for a moment.

I'll add that to the growing list of things you can't believe.
I missed nothing.

That maybe so, but you seemed to miss it. This time you have
addressed the point I made, but you did not address it before.
I pointed out some common layout rules and told him to
use them with manual indenting. It is not rocket science. He can only
understand the code if it is properly, cleanly and consistently laid
out. When opening a brace even Bill can surely learn to hit return and
tab in?


And I do again now.

I do not believe for one minute he is incapable of indenting code
correctly - whichever style he goes for.

That addresses my point, and we can now agree to disagree.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top