Re: Undefined behaviours in D and C

2010-04-18 Thread Pelle
On 04/18/2010 02:46 PM, Walter Bright wrote: Michel Fortin wrote: So you shouldn't be able to cast a value to a pointer. The reverse, casting a pointer to a value, makes sense in my opinion: you may want to print the pointer value in a debug output of some sort. There's nothing unsafe with that

Re: Low dimensional matrices, vectors, quaternions and a cubic equation solver

2010-04-18 Thread Philippe Sigaud
On Mon, Apr 19, 2010 at 01:11, Gareth Charnock wrote: > Couldn't agree more because I'm sure I'll miss tricks and conventions. I > would have never thought of that funky swizzling idea. > Here is a first try with the new operator syntax: http://lists.puremagic.com/pipermail/digitalmars-d/2010-A

Re: Undefined behaviours in D and C

2010-04-18 Thread Walter Bright
bearophile wrote: The first of them is fixed in C99 with the 'restrict' keyword. I guess the D compiler has to assume all pointers can be an alias to each other (but I don't remember if the D docs say this explicitely somewhere) because I think D prefers to not give keywords that the compiler its

Re: Low dimensional matrices, vectors, quaternions and a cubic equation solver

2010-04-18 Thread Gareth Charnock
Andrei Alexandrescu wrote: On 04/16/2010 04:25 PM, Gareth Charnock wrote: Okay, here goes. I've collected together the basic functionality that would probably make a good starting point. As I've mentioned my code is very messy and has bits missing (e.g. I never had a use for the cross product bu

Re: Undefined behaviours in D and C

2010-04-18 Thread bearophile
Walter Bright: Sorry for the delay, I was away. In this post I try to write in a quite explicit way. >I don't see any way to make conversions between pointers and ints >implementation defined,< I see. Thank you for the explanation, I'm often ignorant enough. In my original post I was talking

Re: Undefined behaviours in D and C

2010-04-18 Thread Walter Bright
Michel Fortin wrote: There is a very good reason to disallow manipulating the bit pattern in safe D however: memory safety. If you can dereference a pointer made from an arbitrary bit pattern, you may have an exploitable flaw similar to a buffer overrun. Dereferencing an arbitrary value is defi