delphi - Could omission of "^" when accessing a record pointer's members cause an access violation? -
In VirtualTreeview, I am storing my data in PVirtualNodes . I have many in my app Access violation (usually "Read the address 00000000" ), and they mostly (I really dare to say always) when I am doing something with my node data. However, this is the thing, I used to do my stuff; Use it like this: As you've probably seen, By MyData "dereference" (right?) Do not "MyData" Are you ^ ! The reason for this is not that I have been told that it was not necessary to add caret to the pointer, although I think there is something to do with it. If I knew, then I am not posting here. ;) So my question is, is it necessary to add this small When you have a pointer to a record, you can leave ^. The following are the parallel: This is also a matter for the deprecated turbo pascal Unfortunately, this is not an explanation for your AV.
// dummy code - IDE var MyNode: PVirtualNode; MyData: PMIDoddata; Start MyNode: = VST.GetFirst selected; If assigned (MyNode) then start MyData: = VST.GetNodeData (MyNode); If assigned (MyData) then start MyData.DummyProperty: = 'Test'; End; End; End;
^ to MyData? And is it possible that by not doing so, can I have an admission violation?
MyData.DummyProperty MyData ^. DummyProperty
item . I hope to do this for Delphi classes, although I have never tried it because they are already reference types.
Comments
Post a Comment