Wacky Programming Tales

Patrick Bogaart bogw at geo.vu.nl
Wed Aug 18 12:50:19 EDT 1999


Ben Caradoc-Davies wrote:
> 
> [strange programming]
> The most confidence uninspiring piece of code I ever had the displeasure to
> maintain contained something like this (allegedly C++, but mainly it's
> intersection with C):
> 
>         i = 0;
>         while( i < max_index ) {
>                 /* some copying or update (not modifying i) goes here */
>                 i = i + 1;
>         }
> 
> This was written by a *very* expensive consultant working for a large
> multinational accountancy firm.
> 
> Can anybody suggest an alternative construct which more accurately expresses
> the programmer's intentions? There may be more than one way to do it, but,
> puhleeze!
> 

Yes I can:

	i = 0;
	label_1:;
	/* some use of i */
	i = i + 1;
	if (i==max_index) goto label_2;
	goto label_1;
	label_2:;

<wink>

--
Patrick W. Bogaart
Department of Geomorphology and Quaternary Geology
Faculty  of Earth Sciences,  Vrije Universiteit Amsterdam
bogw at geo.vu.nl            http://www.geo.vu.nl/users/bogw




More information about the Python-list mailing list