Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 15, 2005 problem with pointers | ||||
---|---|---|---|---|
| ||||
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? |
January 15, 2005 Re: problem with pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef | "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 |
January 15, 2005 Re: problem with pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef |
bobef wrote:
[...]
> I get Access Violation if I use "node.parent".
[...]
Seems that you want to use "node.parent*".
-manfred
|
January 15, 2005 Re: problem with pointers | ||||
---|---|---|---|---|
| ||||
Posted in reply to bobef Attachments: | Try this! (I hope it works... I am no longer using this version) I am going to re-design it soon. Miguel Ferreira Simoes |
Copyright © 1999-2021 by the D Language Foundation