digitalmars.D - problem with pointers
- bobef <bobef_member pathlink.com> Jan 15 2005
- "Ben Hinkle" <ben.hinkle gmail.com> Jan 15 2005
- "Manfred Nowak" <svv1999 hotmail.com> Jan 15 2005
- "Miguel Ferreira Simões" <Kobold netcabo.pt> Jan 15 2005
I am writing a XML parser in D, because all the links with such libriraries are dead. And I have the following problem. When I parse the tags I set parent to each node (with pointer, basicly "something.parent=&somethingelse;"). When all is done address of objects seems changed and I get Access Violation if I use "node.parent". I tried to do the work with "cast(XMLnode*)somethingelse" instead of "&somethingelse" but it doesnt work neither. I could't find documentation about pointers in D and I'm stuck. Any ideas why is this?
Jan 15 2005
"bobef" <bobef_member pathlink.com> wrote in message news:csbh1t$2i0e$1 digitaldaemon.com...I am writing a XML parser in D, because all the links with such libriraries are dead. And I have the following problem. When I parse the tags I set parent to each node (with pointer, basicly "something.parent=&somethingelse;"). When all is done address of objects seems changed and I get Access Violation if I use "node.parent". I tried to do the work with "cast(XMLnode*)somethingelse" instead of "&somethingelse" but it doesnt work neither. I could't find documentation about pointers in D and I'm stuck. Any ideas why is this?
Assuming your nodes are class objects and not structs it will work if you remove the &. Class objects in D have reference semantics (like Java, unlike C++) so using & takes the address of the reference not the object itself. -Ben
Jan 15 2005
bobef wrote: [...]I get Access Violation if I use "node.parent".
Seems that you want to use "node.parent*". -manfred
Jan 15 2005
Try this! (I hope it works... I am no longer using this version) I am going to re-design it soon. Miguel Ferreira Simoes
Jan 15 2005









"Ben Hinkle" <ben.hinkle gmail.com> 