C Style
Peter da Silva
peter at graffiti.UUCP
Mon Sep 23 21:53:57 AEST 1985
> versus NO GOTO VERSION
>
> for ( ; (((ch=getch()) < '1' || ch > '5') && ch != 'E') ; )
> putchar(BELL);
> addch(ch);
> refresh();
>
> My background is predominately from a FORTRAN-BASIC-PL/I
> environment, so I tend to think of the FOR (.;.;.){} in terms
> of DO .. CONTINUE, iterative DO .. END or DO WHILE .. END constructs,
> where this kind of an assignment in the conditional is verboten.
Obviously. A 'C' programmer would have written:
while( ((ch=getch()) < '1' || ch > '5') && ch != 'E')
beep();
addch(ch);
refresh();
It's considered bad form to have a for loop with more than 1 empty feild.
Now that you're using a construct that doesn't exist in FORTRAN or BASIC
do you feel better?
More information about the Comp.lang.c
mailing list