RFC: Behavior of continue in do/while loops.
Downs
default_357-line at yahoo.de
Wed Sep 12 13:43:53 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Manfred Nowak wrote:
> Downs wrote
>
>> First, if you were starting a new language, should the behavior of
>> continue in that language match what I expected in this case?
>> (theoretical case)
>
> No.
>
> According to your introduction you might have entangled yourself by
> trying to optimize away a loop nested in another loop:
>
> do{
> do{
> }while( );
> }while( );
>
> -manfred
Actually, I was writing HTTP a downloader and trying to make it embed
special-case logic for 1.1 chunks in a 1.0 loop
along the lines of
do {
receive;
if (isChunked) {
if (chunkedDownloading) continue;
break;
}
} while (notReceivedEnough)
so I expected the continue to restart the loop, but it executed the
condition (which naturally failed abysmally, because I wasn't doing a
normal download :)
Doesn't matter, it works now.
--downs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFG6E+JpEPJRr05fBERAp4bAJ9W/K15qgbpPg+P301+rBNeKC/PcACgkVgj
6N0xl0ARvyd5pqcc8kBWKlc=
=YDS2
-----END PGP SIGNATURE-----
More information about the Digitalmars-d
mailing list