[comp.lang.c] A question of commas

sullivan@aqdata.uucp (Michael T. Sullivan) (12/08/89)

From article <257E97F4.24962@ateng.com>, by chip@ateng.com (Chip Salzenberg):
> 
> For example, "i = i + 1" is inherently harder to read than "i++", since the

But more programmers (BASIC, pascal, etc.) use "i = i + 1", and using "i++"
assumes future programmers working with the code know C.  Obviously, the
first choice is the correct choice :-|.
-- 
Michael Sullivan          uunet!jarthur.uucp!aqdata!sullivan
aQdata, Inc.
San Dimas, CA

parke@galaxy.enet.dec.com (12/08/89)

In article <1989Dec7.192215.27671@aqdata.uucp>, sullivan@aqdata.uucp
(Michael T. Sullivan) writes:
> From article <257E97F4.24962@ateng.com>, by chip@ateng.com (Chip Salzenberg):
> > 
> > For example, "i = i + 1" is inherently harder to read than "i++", since the
> 
> But more programmers (BASIC, pascal, etc.) use "i = i + 1", and using "i++"
> assumes future programmers working with the code know C.  Obviously, the
> first choice is the correct choice :-|.
> -- 

Not to mention the fact that i++ is dependent on what i is (though in C
so is +1 (which might be 1,2,4,8... ))

	}8-)}
		Bill

cpcahil@virtech.uucp (Conor P. Cahill) (12/08/89)

In article <1989Dec7.192215.27671@aqdata.uucp>, sullivan@aqdata.uucp (Michael T. Sullivan) writes:
> From article <257E97F4.24962@ateng.com>, by chip@ateng.com (Chip Salzenberg):
> > 
> > For example, "i = i + 1" is inherently harder to read than "i++", since the
> 
> But more programmers (BASIC, pascal, etc.) use "i = i + 1", and using "i++"
> assumes future programmers working with the code know C.  Obviously, the
> first choice is the correct choice :-|.

When I am writing a C program, I expect future programmers that will be working
with it to know C.  If not, then I should have written it in a different
language.

-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+

darcy@druid.uucp (D'Arcy J.M. Cain) (12/08/89)

In article <1989Dec7.192215.27671@aqdata.uucp> sullivan@aqdata.uucp (Michael T. Sullivan) writes:
>From article <257E97F4.24962@ateng.com>, by chip@ateng.com (Chip Salzenberg):
>> 
>> For example, "i = i + 1" is inherently harder to read than "i++", since the
>
>But more programmers (BASIC, pascal, etc.) use "i = i + 1", and using "i++"
>assumes future programmers working with the code know C.  Obviously, the
>first choice is the correct choice :-|.

Huh!! You mean C code should be readable by people who don't know C?

-- 
D'Arcy J.M. Cain (darcy@druid)     |   "You mean druid wasn't taken yet???"
D'Arcy Cain Consulting             |                    - Everybody -
West Hill, Ontario, Canada         |
No disclaimers.  I agree with me   |

jmann@bigbootay (Jim Mann) (12/08/89)

Yes, some constructs in C are hard to understand for those new to
the language. i++ is NOT one of them.  

Yes, BASIC, FORTRAN, PL/I, and so forth use i = i + 1 to increment i.
However, if you know any C at all, you know what i++ and i-- mean. 
If you don't, you probably shouldn't be trying to maintain C code. 

sullivan@aqdata.uucp (Michael T. Sullivan) (12/09/89)

From article <1989Dec8.122534.1253@virtech.uucp>, by cpcahil@virtech.uucp (Conor P. Cahill):
> In article <1989Dec7.192215.27671@aqdata.uucp>, sullivan@aqdata.uucp (Michael T. Sullivan) writes:
>> 
>> But more programmers (BASIC, pascal, etc.) use "i = i + 1", and using "i++"
>> assumes future programmers working with the code know C.  Obviously, the
>> first choice is the correct choice :-|.
> 
> When I am writing a C program, I expect future programmers that will be working
> with it to know C.  If not, then I should have written it in a different
> language.

1) Somebody can't read little smirking faces.

2) If we can assume that C programmers will be maintaining C code (a reasonable
   assumption) then they should be able to understand commas.
-- 
Michael Sullivan          uunet!jarthur.uucp!aqdata!sullivan
aQdata, Inc.
San Dimas, CA

bret@codonics.COM (Bret Orsburn) (12/12/89)

In article <1989Dec8.122534.1253@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes:
>When I am writing a C program, I expect future programmers that will be working
>with it to know C.


AMEN, Brother! At least we can draw the line on portamania at the boundary
between languages! :-)


-- 
-------------------
bret@codonics.com
uunet!codonics!bret
Bret Orsburn

mark@jhereg.Minnetech.MN.ORG (Mark H. Colburn) (12/13/89)

In article <1989Dec7.192215.27671@aqdata.uucp> sullivan@aqdata.uucp (Michael T. Sullivan) writes:
>But more programmers (BASIC, pascal, etc.) use "i = i + 1", and using "i++"
>assumes future programmers working with the code know C.  Obviously, the
>first choice is the correct choice :-|.

If the programmers that are maintaining the code do not know about the
little details of C, such as post decrement and post increment operators,
then they are going to have a really tough time understanding virtually any
code that uses the features of the language that make it so desirable.

Writing code to the least common denomonator is not a good way to write
code.  If there are portable features of a language that would be known to
a competent programmer in that language, then you should use them.  I
would say that using techniques which are tricky and unportable should be
avoided, unless they are absolutely necessary.  You have to assume that the
person that is going to be working with your code is fluent in the language
that you are using, or that they will be learning quickly!

Portability is not just so that code can be moved to differenct
architectures and run, but also to allow programmers to move between
different architectures and understand code.

-- 
Mark H. Colburn                       mark@Minnetech.MN.ORG
Open Systems Architects, Inc.

amull@Morgan.COM (Andrew P. Mullhaupt) (12/14/89)

In article <593@codonics.COM>, bret@codonics.COM (Bret Orsburn) writes:
> In article <1989Dec8.122534.1253@virtech.uucp> cpcahil@virtech.uucp (Conor P. Cahill) writes:
> >When I am writing a C program, I expect future programmers that will be working
> >with it to know C.
> 
> 
> AMEN, Brother! At least we can draw the line on portamania at the boundary
> between languages! :-)
Say the boundary between C (UNIX-Style like on a Sun) and C (ANSI-Style
like with prototypes)? (:-))

Later,
Andrew Mullhaupt