Article View: net.lang.c
Article #9223for != while
From: karl
Date: Mon, 01 Sep 1986 20:53
Date: Mon, 01 Sep 1986 20:53
15 lines
883 bytes
883 bytes
It's well known that the equivalence between for and while breaks down if
there's a "continue" statement. Here's another case I just discovered:
main() {
char *foo = "outer";
for (;; printf(foo),exit(0)) {
char *foo = "inner";
}
}
This prints "outer" (vax SVR2 compiler), though the for-while equivalence
might lead one to expect "inner".
Karl W. Z. Heuer (ima!haddock!karl, karl@haddock.isc.com), The Walking Lint
Technical Details
Message-ID:
<86900030@haddock>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karlShow 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: for != while Message-ID: <86900030@haddock> Date: Mon, 1-Sep-86 16:53:00 EDT Article-I.D.: haddock.86900030 Posted: Mon Sep 1 16:53:00 1986 Date-Received: Tue, 2-Sep-86 21:06:56 EDT Lines: 15 Nf-ID: #N:haddock:86900030:000:424 Nf-From: haddock!karl Sep 1 16:53:00 1986