argument list style (was: coding style) 
Author Message
 argument list style (was: coding style)

I don't remember where I picked up this habit, but I've been writing
function calls as follows...

   x = foo( a, b);

i.e., with a space after the open paren (and spaces after commas separating
arguments).  Subjectively, I think it improves readability a tad because of
better token separation and the explicit difference from other uses of parens.

Comments?  Anybody out there who totally hates this?
--


Mount Holyoke College        |      Voice: (US) 413-538-2375 (daytime)
South Hadley, MA, USA        | Snail Mail: J. Botz, 01075-0629



Fri, 17 Jun 1994 01:25:04 GMT  
 argument list style (was: coding style)

Quote:

>   x = foo( a, b);
>Comments?

I've simply been writing
        x = foo (a, b);
which is aesthetically much better for me, and easy to see.
Do people think this is *wrong*?
..Paul Fly...                  "Thinking is more interesting than knowing,




Fri, 17 Jun 1994 09:09:00 GMT  
 argument list style (was: coding style)

Quote:
>I've simply been writing
>    x = foo (a, b);
>which is aesthetically much better for me, and easy to see.
>Do people think this is *wrong*?

I used to use that style myself, because it is easy to read.  But,
if you ever decided to make foo a macro instead of a function, you
would have to eliminate the space before the opening parenthesis.


I wish I had a real .sig.



Fri, 17 Jun 1994 11:17:25 GMT  
 argument list style (was: coding style)

Quote:

>I don't remember where I picked up this habit, but I've been writing
>function calls as follows...

>   x = foo( a, b);

>i.e., with a space after the open paren (and spaces after commas separating
>arguments).  Subjectively, I think it improves readability a tad because of
>better token separation and the explicit difference from other uses of parens.

>Comments?  Anybody out there who totally hates this?

I have no reason to hate it.  But I do tend to go a little more extreme in
my own coding style:

    x = foo( a , b );

Comments?  Anybody out there who totally hates this?
--
/***********************************************************************\

| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/



Sat, 18 Jun 1994 02:35:09 GMT  
 argument list style (was: coding style)

Quote:

> >I've simply been writing
> >       x = foo (a, b);
> >which is aesthetically much better for me, and easy to see.
> >Do people think this is *wrong*?
> I used to use that style myself, because it is easy to read.  But,
> if you ever decided to make foo a macro instead of a function, you
> would have to eliminate the space before the opening parenthesis.

Not true for cpp. Either "classic" or "ANSI".  Unless there's some other
bizarre cpp that I never heard of (of course, there must be, given the
nature of these things :-/).

This was/is only true for m4, the other popular macro processor on Unix.

-----
Shankar Unni                                   E-Mail:

Phone : +91-812-265595                           UUCP: ...!hplabs!hpda!shankar



Sat, 18 Jun 1994 13:44:41 GMT  
 argument list style (was: coding style)

Quote:
>>   x = foo( a, b);

>I've simply been writing
>    x = foo (a, b);

>which is aesthetically much better for me, and easy to see.
>Do people think this is *wrong*?

NO! :-)

I like to leave spaces after *MOST* operators (a->b NOT a-> b excluded, par
example) and I think it makes life a ton of a lot easier.   e.g.:-

foo++;
foo + bar;
foo = bar;
foo = bar + c;
*foo = 5;
*(foo + 5) = 10;
printf("hello world %i %i\n", foo, bar(foo));
if (foo == bar)
        foo = ++bar;
foo.bar = bar.foo
foo = bar->foobar()
if (foo && bar)
        foobar();

and what's more is that I like decent vertical spacing in prototypes.....

void activate(void);
void deactivate(void);
void display(void);

void set_xy(int x, int y);
void resize(int new_height, int new_width);
void move(int new_ypos, int new_xpos);

No Holy Flame Wars pleez, just commenting on my fave C style..   :-)

Cheers
Andy

________________________________________________________
F   L   O   O   P:-   chumbly bumbly, jump for the telly

--



Mon, 20 Jun 1994 09:49:47 GMT  
 argument list style (was: coding style)


 > >   x = foo( a, b);
 >     x = foo( a , b );
 > Comments?  Anybody out there who totally hates this?
Yes, I hate everything that is not *my* style.  It dates from the times when
I was playing with Algol-60.  But I will not tell you because than you will
hate my style.
--
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland



Sat, 18 Jun 1994 10:02:06 GMT  
 argument list style (was: coding style)

Quote:

> I don't remember where I picked up this habit, but I've been writing
> function calls as follows...
>    x = foo( a, b);
> Subjectively, I think it improves readability a tad because of
> better token separation and the explicit difference from other uses of parens.
> Comments?  Anybody out there who totally hates this?

I totally hate this.  The reason that I hate it is that I find it hard to
read.  Why do I find it hard to read?  Because it violates the usual layout
rules for English.  The basic rules for punctuation spacing are
        -- a narrow space between words
        -- a wide space between sentences
        -- ( [ { 6 66 << snuggle up the to word on the right
        -- ) ] } 9 99 >> , ; : . ? ! snuggle up to the word on the left
If anything, this dictates the layout
        x = foo (a, b);
which I happen to dislike, but have to respect.

I don't see any ``better token separation'' in "foo( a, b);".  I see a
"fracture" in the middle of something so that my eye stumbles over it.

However, it is a _reasoned_ suggestion, which counts for a lot, so if
Jurgen Botz also writes "a[ i][ j] = foo( 1);" all is well.

--
I am writing a book on debugging aimed at 1st & 2nd year CS students using
C/Modula/Pascal-like languages.  Please send suggestions (other than "you



Tue, 21 Jun 1994 13:52:01 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. MFC source code for List View style control?

2. old style casts vs new style casts

3. K&R C style to ANSI C Style

4. new style declarations OK for old style definitions?

5. Need help with reinterpret_cast, a C-style cast or function-style cast

6. Convert old-style func decl to ANSI-style?

7. old style casts vs new style casts

8. Need help with reinterpret_cast, a C-style cast or function-style cast

9. Need help with reinterpret_cast, a C-style cast or function-style cast

10. old C style to new C style conversion

11. GDI - enhanced pen styles, hatch styles

12. Need help with reinterpret_cast, a C-style cast or function-style cast

 

 
Powered by phpBB® Forum Software