[comp.lang.c] A question of stylecode!

dbin@norsat.UUCP (Dave Binette) (12/05/89)

I like commas, but rarely use them (except in 'for' loops).

I also like the ternary operator  ?:  and make it a habit never
to nest them more than 5 or six deep (-;  *just joking*

Personally I see programming as an art, and upon encountering a new
artists work i look for style and competance, If the Author has an
accent (even if its inverted) I can joyfully accept it.

Its the thought that counts.

But in the final analysis regarding this ',' (comma) business....
does it make any differrence to the compiled code?
Is this something an optimizer will eat for breakfast?

I don't see the use of (comma) as being confusing,  code expresses the
authors synthesis of the goal,  not vice-versa.

(gosh my speeling is bad tonight)

henry@utzoo.uucp (Henry Spencer) (12/06/89)

In article <165@norsat.UUCP> dbin@norsat.UUCP (Dave Binette) writes:
>Personally I see programming as an art, and upon encountering a new
>artists work i look for style and competance, If the Author has an
>accent (even if its inverted) I can joyfully accept it.

But remember what the artists say:  "form liberates".  That is, working
within an existing form frees your creative energy for issues that matter.

>Its the thought that counts.

In professional programming, it's the quality of the product that counts.
-- 
Mars can wait:  we've barely   |     Henry Spencer at U of Toronto Zoology
started exploring the Moon.    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

ge@kunivv1.sci.kun.nl (Ge' Weijers) (12/08/89)

dbin@norsat.UUCP (Dave Binette) writes:

>But in the final analysis regarding this ',' (comma) business....
>does it make any differrence to the compiled code?
>Is this something an optimizer will eat for breakfast?

Most compilers won't even let the optimiser see this one. Especially pcc.
Constructs like these are usually removed in the semantic analysis phase.


Ge' Weijers
Ge' Weijers                                    Internet/UUCP: ge@cs.kun.nl
Faculty of Mathematics and Computer Science,   (uunet.uu.net!cs.kun.nl!ge)
University of Nijmegen, Toernooiveld 1         
6525 ED Nijmegen, the Netherlands              tel. +3180612483 (UTC-2)

decot@hpisod2.HP.COM (Dave Decot) (12/15/89)

> I always thought that an interesting use for the comma was in a for
> loop when one wanted, say, to create the identity matrix:

I agree completely.  However the following code:

> 	float	array[SIZE][SIZE];
> 	int	i,j;
> 
> 	/* initialize the whole thing to zero, then to this: */
> 	for(i=0,j=0; i<SIZE; i++, j++)
> 		array[i][j] = 0;

creates the following matrix:

      0     garbage garbage garbage ... garbage
    garbage    0    garbage garbage ... garbage
    garbage garbage    0    garbage ... garbage
      .        .       .       .    ...    .
      :        :       :       :    :::    .
    garbage garbage garbage garbage ...    0

...which is not precisely what I wanted.

Dave Decot