In article <brt5sp$fu3$1@chessie.cirr.com>,
Christopher Benson-Manica <ataru@nospam.cyberspace.org> wrote:[color=blue]
>(don't worry, it isn't homework or anything... just a brain-teaser if
>you're so inclined)
>
>#include <stdlib.h>
>
>int main(void)
>{
> unsigned long i,j,k;
>
> for(i=j=k=1;--j||k;k=j?i%j?k:k-j:(j=i+=2));
> return EXIT_SUCCESS;
>}[/color]
Since you're not outputting anything, the options are "infinite loop" or
"spin wheels and eventually return", with varying amounts of time that the
"spin wheels" part could take. The "spin wheels and eventually return"
option can be converted by a sufficiently aggressive optimizer to "return
immediately", though the general case for that may require solving the
halting problem.
It looks to me like it's an infinite loop.
(I'll give some other people a chance to see it and agree or disagree
with me and, if I remember, post my analysis later.)
dave
--
Dave Vandervies
dj3vande@csclub.uwaterloo.ca
But that's only because, underneath my mean, callous exterior, there's
a mean, callous interior waiting to be unleashed.
--Richard Heathfield