www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is it legal to have a function taking two aliased slices?

reply "ponce" <contact gam3sfrommars.fr> writes:
Example:
     void process(float[] input, float[] output)
     {
       // do stuff
     }


I'd like to sometimes have overlapping slices, and don't want the 
compiler to assume they do not overlap.
Jul 10 2015
parent reply Steven Schveighoffer <schveiguy yahoo.com> writes:
On 7/10/15 9:20 AM, ponce wrote:
 Example:
      void process(float[] input, float[] output)
      {
        // do stuff
      }


 I'd like to sometimes have overlapping slices, and don't want the
 compiler to assume they do not overlap.
Yes, it's legal, and the compiler doesn't assume anything about the two slices, including whether they overlap or not. -Steve
Jul 10 2015
parent "ponce" <contact gam3sfrommars.fr> writes:
On Friday, 10 July 2015 at 13:54:47 UTC, Steven Schveighoffer 
wrote:
 On 7/10/15 9:20 AM, ponce wrote:
 Example:
      void process(float[] input, float[] output)
      {
        // do stuff
      }


 I'd like to sometimes have overlapping slices, and don't want 
 the
 compiler to assume they do not overlap.
Yes, it's legal, and the compiler doesn't assume anything about the two slices, including whether they overlap or not. -Steve
Cool, thanks!
Jul 10 2015