Slawek
I know what you mean. For about 10 years I made my living
either teaching C programming language or using it to
replace assembly code or -- less commonly -- to develop
application. This used to be the original, bare-bone K&R C.
Or -- as in the time of CP/M (do you remember?) -- I used
a still-simpler compiler: BDS-C (BD stands for Brain-damaged
or something like that.
As to the loop, it seems things like
for ( ; n ; ++n)
mistifies more than any otherthing with the probable exception
of things like
a = a ? b : c;
- fernando
"Slawek K. Grzechnik" wrote:
> In computer related fields zero is used ruthlessly up to a point of
> counting pages.
> Non-programmer calls his programmer friend and tells him
> - I faxed you 10 pages of my recent paper
> The other guy starts counting 0,1,...,9 and calls back
> - only 9 arrived
> This is a joke of course playing the trick of so called "fence post error".
>
> In C/C++ a loop on n is an idiom
>
> for( i = 0; i < n; i++ ) {
> .....
> }
>
> which fits very well array indexing and pointer arithmetics.
>
> if you see in the code a loop like
>
> for( i = 1; i <= n; i++ ) {
> }
>
> then you have to study the code carefully because probably the author had
> something special in mind or else he was a fool. Note that from the point
> of view of number of iterations both loops are equivalent ("less than n" in
> first loop, "less or equal n" in the second).
--
Fernando Cabral Padrao iX Sistemas Abertos
mailto:[EMAIL PROTECTED] http://www.pix.com.br
Fone Direto: +55 61 329-0206 mailto:[EMAIL PROTECTED]
PABX: +55 61 329-0202 Fax: +55 61 326-3082
15º 45' 04.9" S 47º 49' 58.6" W
19º 37' 57.0" S 45º 17' 13.6" W