Hello Jaideep,
Jaideep Khadilkar wrote:
> HI.......
>
> I am getting a weired problem when using referencing a NodePtr ;
> I am using OpenSG with Fltk. Due to the callback structure of Fltk ,
> when I want to pass a NodePtr to the callback function, I have to pass
> void* instead.
> For that, I am passing the "pointer to NodePtr " in the call, and in the
> function i am Dereferencing the "pointer to NodePtr " to get the
> original NodePtr.
Why do you need the original _NodePtr_ instead of a NodePtr that points
to the same _Node_?
> But my program was crashing. So to test I did something like this.
>
> importedGeoN is of type NodePtr
>
> cout << "importedGeoN Before : "<< importedGeoN << "\n";
> void* vPtr = (void*)&importedGeoN;
> NodePtr* selNodePtr = (NodePtr*)vPtr;
> NodePtr selNode = (NodePtr)*selNodePtr;
> cout << "importedGeoN After : "<< selNode << "\n";
>
> OUTPUT :
> importedGeoN Before : NodePtr 0x0x7fffff8ec440:NodePtr(0x0x9b49b8)
> importedGeoN After : NodePtr 0x0x7fffff8ec410:NodePtr(0x0x9b49b8)
>
> Both values should have been the same.
> Why there is a difference in both values????
No, they can no be the same value, as they are the addresses of two
distinct objects, both of type NodePtr: the first one is importedGeoN
and the other one is selNode. The important thing is that they both
point to the same Node, as you can see from the second address on each line.
Hope it helps,
Carsten
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users