Path: utzoo!attcan!uunet!seismo!sundc!pitstop!texsun!texsun.central.sun.com!convex!authorplaceholder From: hutchson@convex.UUCP Newsgroups: comp.lang.c Subject: Re: Noalias trivia question Message-ID: <64400012@convex> Date: 22 Jun 88 22:00:00 GMT References: <314@proxftl.UUCP> Lines: 15 Nf-ID: #R:proxftl.UUCP:-31400:convex:64400012:000:680 Nf-From: convex.UUCP!hutchson Jun 22 17:00:00 1988 For a less contrived example: for (i=n; i; i--) a[i]=i; /* each number in (i:n) occurs once in a. */ shuffle(a); /* randomly or not--doesn't matter. */ ... Now, the programmer knows full well that i!=j implies a[i]!=a[j]. But try explaining that to your favorite optimizer. Better hope it understands second-order logic. If you really want a challenge, try letting it figure it out for itself. Remember that this property of a is not created, but is maintained, by "shuffle". Such code would be found somewhere in, say, a blackjack simulation. I suspect that properties of permutations of arrays might be useful in more productive programs also.