   Setting a pointer location from a string
  Hi all,This is something that has just tickled my curiosity.I'm currently redeveloping the property system within my engine, giving it an overhaul to make it more extensible (at the moment you have to modify in-engine .h and .cpp files to add property types, which is no good really). As I'm implementing standard property types I wish to house within the engine such as an IntProperty or a StringProperty I came across the property type which handles a void*.Now this data type is a bit redundant int the new system, however I'm implementing it to keep backwards compatibility, here's the fun bit, and this isn't the behaviour I want (I don't think) so i wont be implementing it:Each property has a ToString and FromString function, now I can cast the pointer to an int, and then turn that integer into a string, does this work the other way around? I can set a pointers location from a string IE. (semi-pseudo code)Foo *foo1 = new Foo();   // create instance of fooVoidPtrProperty *prop1 = new VoidPtrProperty(foo1); // prop1 wraps up a void* pointing to foo1VoidPtrProperty *prop2 = new VoidPtrProperty(); // wraps up a void* pointing to NULLprop2->FromString(prop1->ToString()); // prop2 now points to foo1 as wellThis has just interested me, tis all =]Scott   
  This might work (i.e. it's technically possible to do the pointer -> int -> string -> int -> pointer cycle you describe) but it's not really a great idea to be relying on such behaviour, as there's a good chance that at least one step in there is technically undefined. For instance, on 64-bit architectures, casting a pointer to a 32-bit integer is going to cause you all manner of chaos.   ;  Converting the string to uintptr_t and then to a pointer might work, but not something I recommend :)   