Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ic.Berkeley.EDU!faustus From: faustus@ic.Berkeley.EDU (Wayne A. Christopher) Newsgroups: comp.lang.c Subject: Re: no noalias not negligible Message-ID: <3630@pasteur.Berkeley.Edu> Date: 24 May 88 20:42:47 GMT References: <4152@haddock.ISC.COM> <54080@sun.uucp> <1988May21.030207.25063@light.uucp> Sender: news@pasteur.Berkeley.Edu Lines: 28 In article <4152@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: > >How about adding a test before the for loop? Something like: > >#define overlap(x,y,n) (!(x + n <= y || y + n <= x)) > > if (overlap(dx, dy, n)) > > return complain("overlapping arrays\n"); > > > >Now a smart compiler can figure out that dx, dy don't overlap ... > > The information is there, and a human reader can prove it, but I don't think > they make compilers that smart yet. The compler doesn't have to see it. Probably a better way of saying it is that the compiler will translate into if ( ) { } else { } Are there any constructs that couldn't be figured out at run-time without a large penalty? Maybe if you were re-directing through an array of pointers... Wayne