Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!mintaka!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: <18392@haddock.ima.isc.com> Date: 3 Oct 90 04:15:11 GMT References: <1990Oct1.174941.22195@zoo.toronto.edu> <18370@haddock.ima.isc.com> <1990Oct2.192727@IASTATE.EDU> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 13 In <1990Oct2.192727@IASTATE.EDU> john@IASTATE.EDU (Hascall John Paul) writes: >In <18370@haddock.ima.isc.com>, karl@haddock.ima.isc.com (Karl Heuer) writes: >>[Problems if it's unsigned; suggested ways to fix] > >I suppose this is so hideous that I shall be cursed forever for it... ;-) > unsigned int x; > for (x = 100; (int)--x > 0; ) Um, the "100" in this discussion is really just a placeholder for whatever the iteration count happens to be--and it would be nice if the algorithm would also work when the count is in the high range of an unsigned int. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint