From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Alex Rosenberg" To: Claus Fischer , Jeffrey A Law Cc: Joe Buck , Mark Mitchell , GCC mailing list , Richard Stallman Subject: Re: type based aliasing again Date: Thu, 30 Sep 1999 18:02:00 -0000 Message-ID: <199909100453.VAA23365@scv2.apple.com> X-SW-Source: 1999-09n/msg00392.html Message-ID: <19990930180200.kDqs2tYkLdzu1LlKcNkWoM4XdATMtkav6robKpfSxeo@z> > Well this option would just tell the compiler that there are no aliases, > guaranteed, on my full responsibility. Like in a function: > > double f(double *x, double *y, long n) ... > > when I the programmer happen to know there can't be an alias (the > memory areas x and y are totally nonoverlapping on the full range) > but the compiler can't detect that since n could have any value. IBM's xlC and Apple's MrC use the following syntax for this case: #pragma disjoint (x,y) Where any pointer name with any number of dereferences, denoted by an asterix, can appear in a group. AFAIK, C9X's restrict keyword doesn't help here since we're only asserting that these two pointers aren't overlapping, not that they don't overlap with something else of interest to the compiler. Another possible solution is a syntax I've seen in Microsoft's VC++: __assume(x != y); Where __assume() is usually a non-debug replacement for assert(). This particular expression doesn't denote lack of overlap, but possibly some suitable expression can be devised that works. This is also a desirable general mechanism for other assertions. (If anybody knows of a paper on this as a general mechanism, I'd love to read it.) +------------------------------------------------------------+ | Alexander M. Rosenberg < mailto:alexr@_spies.com > | | Nobody cares what I say. Remove the underscore to mail me. |