C Programming Style -- New thought ("writing code")
Frank Adams
franka at mmintl.UUCP
Tue Jul 30 05:51:39 AEST 1985
In article <241 at frog.UUCP> john at frog.UUCP (John Woods) writes:
>As an example: the recent BYTE article on the TRAVESTY program (a few months
>back) included a PASCAL program with a doubly nested loop, which had to use
>a logical variable to escape from the inner one (I believe that that required
>a double test in the while). I recoded it in C, and came up with half the
>number of lines, SIMPLIFIED IT TO A SINGLE LOOP using "C ``tricks''", and
>came up with what I felt was vastly more readable code: the whole function
>"fit in my mind" at once.
If you simplified it to a single loop, it sounds like you changed the
algorithm. What happens if you try to reconvert to PASCAL without adding
back the extra loop? If this isn't possible, just exactly what "tricks"
did you use?
More information about the Comp.lang.c
mailing list