ubyte array changing values between calls? Possible bug?

John Colvin john.loughran.colvin at gmail.com
Sat Dec 14 02:05:22 PST 2013


On Friday, 13 December 2013 at 18:01:53 UTC, Rémy Mouëza wrote:
>
> It works fine when using dup to the value returned by 
> nativeToBigEndian:
>     public void opAssign(uint value)
>     {
>         this._octets = value.nativeToBigEndian().dup;
>         assert(this._octets == cast (ubyte[]) [1, 2, 3, 4]);
>     }
>

As expected, as dup allocates a new array on the heap.


More information about the Digitalmars-d-learn mailing list