🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9263

Re: for != while

#9263
From: karl
Date: Sat, 06 Sep 1986 16:52
19 lines
1164 bytes
pogo!operator (Shannon Nelson) writes:
>... The correct translation of your for loop into a while loop is:
>main() {
>        char *foo = "outer";
>        while (TRUE) {
>                { char *foo = "inner"; }
>                printf(foo);
>                exit(0);
>        }
>}

Oops.  You're right; I forgot about the extra braces.

But as long as we're on the subject, shouldn't the general whilified for be
written "{ e1; while (e2) { statement e3; } }", with the extra pair of braces
surrounding the whole mess?  (Consider "if (e0) for (e1; e2; e3) statement".)

Karl W. Z. Heuer (ima!haddock!karl; karl@haddock.isc.com), The Walking Lint
Technical Details
Message-ID: <86900042@haddock>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karl
References: <86900030@haddock>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karl
From: karl@haddock
Newsgroups: net.lang.c
Subject: Re: for != while
Message-ID: <86900042@haddock>
Date: Sat, 6-Sep-86 12:52:00 EDT
Article-I.D.: haddock.86900042
Posted: Sat Sep  6 12:52:00 1986
Date-Received: Sat, 6-Sep-86 20:39:43 EDT
References: <86900030@haddock>
Lines: 19
Nf-ID: #R:haddock:86900030:haddock:86900042:000:648
Nf-From: haddock!karl    Sep  6 12:52:00 1986