[Insight-developers] 64 bit pointers

Leila Baghdadi baghdadi at sickkids.ca
Tue Mar 6 14:23:00 EST 2007


Hi guys,

I just noticed that when I ported my segmentation code to 64 bit, all of
a sudden I got a segmentation fault. I know by experience that I have
messed up a pointer and I figured out the one,

const unsigned long *tp;

InputCellsContainerIterator   cells = myCells->Begin();

while ( cells != myCells->End() ) 
      {
	tp = cells.Value()->GetPointIds();
	std::cout << tp[0] << tp[1] << tp[2] << " "<< std::endl;
	++cells;
      } 

so this code (64 bit) prints large values instead of the usual cell ids.

I know that "long" creates this problem however I am not sure

1. what is the best way to solve this

2. There is identical code at itkDeformableMesh3DFilter!!


any comments

thanks

Leila   



More information about the Insight-developers mailing list