Re: Casting pointers

2015-08-27 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/26/15 8:14 AM, John Burton wrote: This would be undefined behavior in c++ due to aliasing rules on pointers. It appears to work reliably in D when I try it, but that's obviously no guarantee that it's correct or will continue to do so. Is this correct code in D? And if not, what should I

Re: Casting pointers

2015-08-27 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 26 August 2015 at 12:14:54 UTC, John Burton wrote: This would be undefined behavior in c++ due to aliasing rules on pointers. It appears to work reliably in D when I try it, but that's obviously no guarantee that it's correct or will continue to do so. Is this correct code in

Re: Casting pointers

2015-08-27 Thread John Burton via Digitalmars-d-learn
Ok thank you. Seems to me that there is enough doubt that this is supported that I'd be best to avoid relying on it, or at least ensure that it's all encapsulated in something I can easily change.

Casting pointers

2015-08-26 Thread John Burton via Digitalmars-d-learn
This would be undefined behavior in c++ due to aliasing rules on pointers. It appears to work reliably in D when I try it, but that's obviously no guarantee that it's correct or will continue to do so. Is this correct code in D? And if not, what should I do instead to cleanly and efficiently

Re: Casting pointers

2015-08-26 Thread anonymous via Digitalmars-d-learn
On Wednesday 26 August 2015 14:14, John Burton wrote: This would be undefined behavior in c++ due to aliasing rules on pointers. It appears to work reliably in D when I try it, but that's obviously no guarantee that it's correct or will continue to do so. Is this correct code in D? And if