Hi Brad,<br><br>                      You have said it all !  :-)<br><br><br>As usual... what it seemed to be a localized changed<br>turned out to be a massive refactoring.<br><br>We have promiscuously used &quot;long&quot;, and &quot;unsigned long&quot;<br>
all over the place, instead of having had the precaution of<br>declaring a Trait for the components of Size, Index and <br>Offset.  (now we have IndexValueType, SizeValueType,<br>and OffsetValueType).<br><br><br>The same goes for Spacing and Origin, but that&#39;s a bit<br>
of a separate issue.<br><br><br>As you pointed out, we will have to search-and-destroy<br>all explicit uses of &quot;long&quot; and &quot;unsigned long&quot; that refer<br>to Index, Size and Offset components.<br><br><br>
I believe that the changes applied during the weekend are<br>good for covering Linux in 32 and 64 bits, but unfortunately<br>they are still not enough for covering Windows 64 bits,<br>where <br><br><br>     size_t and ptrdiff_t have different size than &quot;long&quot;.<br>
<br><br>Banning the use of &quot;long&quot; will come easy by simply keeping<br>a couple of Windows 64 bits Nightly builds, (once we <br>replace size_t and ptrdiff_t as the component types of <br>Size, Index and Offset.)<br>
<br>In the meantime, unfortunately we will have to go down<br>the painstaking process of cleaning class by class.<br><br><br>The process is not hard, <br>but it promises to be very long:<br><br>It comes down to getting a Visual Studio Windows 64 bits<br>
build to run green, after we replace the new types.<br><br><br>It will be great to get this done by the Release of ITK 3.16,<br>but that may absorb too much of our resources.<br><br><br>I&#39;ll keep working on this as a background task...<br>
<br><br>      Luis<br><br><br>---------------------------<br><div class="gmail_quote">On Mon, Jul 13, 2009 at 11:30 AM, Bradley Lowekamp <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="">Luis,<div><br></div><div><span style="white-space: pre;">        </span>This looks like an absolutely massive effort you are attempting here. I have grepped through the iterator classes are there alot of incorrect usages of long:</div>
<div> </div><div>itkImageRegionReverseConstIterator.h:    m_SpanEndOffset = this-&gt;m_BeginOffset - static_cast&lt;long&gt;(this-&gt;m_Region.GetSize()[0]);</div><div><br></div><div>And then there are complex relations like this:</div>
<div><br></div><div><div>itkSize.h:  typedef   unsigned long     SizeValueType;</div><div><div>itkImageRegion.h:  typedef Size&lt; itkGetStaticConstMacro( ImageDimension ) &gt;  SizeType;</div><div>itkImageRegion.h:  typedef typename SizeType::SizeValueType                  SizeValueType;</div>
<div>itkImageRegion.h:  SizeValueType GetNumberOfPixels() const;</div><div><br></div><div><br></div><div>I am not really sure how all these issues can be tracked down. From the user list:</div><div><br></div><div><br></div>
<div><div class="im"><div>On Jul 10, 2009, at 12:46 PM, Michael Jackson wrote:</div><br><blockquote type="cite"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><br>
IMNSHO, ITK (and VTK by extension) should absolutely BAN the use of<br>&quot;long&quot; in their projects. Period. Too many avoidable bugs come up from<br>its use. If you want a 32 bit integer use int or the standard ansi int<br>
type, if you want a 64 bit integer then use &quot;long long int&quot; or the<br>standard ansi 64 bit integer type.<br>  &quot;long int&quot; is just a mess waiting to happen. Maybe a rule should be<br>put into the KWStyle project to look for and flag the use of &#39;long&#39;?</span></blockquote>
<div><br></div><div><br></div></div><div>Do we need to go as far as banning the use of long and unsigned long? </div><div><br></div><div><br></div><div>Good Luck Luis,</div><div>Brad</div></div><div><br></div></div><div><br>
</div></div><div><br></div><div><div><div><div></div><div class="h5"><div>On Jul 10, 2009, at 6:33 PM, Luis Ibanez wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="h5">On recent realization:   <br>
<br>             &quot;size_t&quot;    is unsigned       :-/<br><br>and we need the OffsetValueType to be signed,<br>since we use it to compute differences...<br><br>It seems that what we need is the type<br> <br>                        &quot;ptrdiff_t&quot;<br>
<br>which is supposed to represent the differences<br>between two pointers, and therefore should be<br>capable of measuring distances between any<br>two locations in memory.<br> <br>I&#39;m now rerunning the Experimental with <br>
&quot;ptrdiff_t&quot; instead of &quot;size_t&quot;.<br><font color="#888888"><br><br>       Luis<br></font><br>------------------------------------------------------------------------------------------------------<br> <div class="gmail_quote">
On Fri, Jul 10, 2009 at 12:30 PM, Luis Ibanez <span dir="ltr">&lt;<a href="mailto:luis.ibanez@kitware.com" target="_blank">luis.ibanez@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 Hi Kana,<br><br>Thanks a lot for looking into this and sharing your findings.<br><br>I just confirmed that in Windows 64bits, the &quot;long&quot; type is<br>only 4 bytes.<br><br>Here is the program I used:<br><br>#include &lt;iostream&gt;<br>
 #include &quot;itkOffset.h&quot;<br>#include &quot;itkNumericTraits.h&quot;<div><br><br>int main()<br>{<br>  unsigned long tt;<br>  std::cout &lt;&lt; &quot;size = &quot; &lt;&lt; sizeof(tt) &lt;&lt; std::endl;<br>   tt  =  -1;<br>
   std::cout &lt;&lt; &quot;tt = &quot; &lt;&lt; tt &lt;&lt; std::endl;<br><br></div>  typedef itk::Offset&lt;3&gt;   OffsetType;<br>  typedef OffsetType::OffsetValueType   OffsetValueType;<br><br>  OffsetValueType  offsetValue;<br>
 <br>  std::cout &lt;&lt; &quot;sizeof(offsetValue) = &quot; &lt;&lt; sizeof( offsetValue ) &lt;&lt; std::endl;<br><br>  offsetValue = itk::NumericTraits&lt; OffsetValueType &gt;::max();<br><br>  std::cout &lt;&lt; &quot;OffsetValueType max() = &quot; &lt;&lt; offsetValue &lt;&lt; std::endl;<br>
 <br>  return EXIT_SUCCESS;<br>}<br><br><br>with this CMakeLists.txt file<br><br><br>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)<br>IF(COMMAND CMAKE_POLICY)<br>  CMAKE_POLICY(SET CMP0003 NEW)<br>ENDIF(COMMAND CMAKE_POLICY)<br><br>
 <br>PROJECT(64bitsTest)<br><br>FIND_PACKAGE(ITK REQUIRED)<br>INCLUDE(${ITK_USE_FILE})<br><br>ADD_EXECUTABLE(typesTest typesTest.cxx )<br><br>TARGET_LINK_LIBRARIES(typesTest ITKCommon)<br><br></blockquote></div><br> </div>
</div><span>&lt;ATT00001.txt&gt;</span></blockquote></div><br><div> <span style="font-size: 12px;"><div style=""><span style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><p style="margin: 0px;">
<font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" size="3" face="Helvetica">========================================================</font></p>
<p style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" size="3" face="Helvetica">Bradley Lowekamp<span> </span><span> </span></font></p>
<p style="margin: 0px;"><font face="Arial"><span style="font-family: Arial;"><span style="font-family: Arial;">Lockheed Martin </span></span></font><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" size="3" face="Helvetica">Contractor for</font></p>
<p style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" size="3" face="Helvetica">Office of High Performance Computing and Communications</font></p>
<p style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" size="3" face="Helvetica">National Library of Medicine<span> </span></font></p>
<p style="margin: 0px;"><font style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-size-adjust: none; font-stretch: normal;" size="3" face="Helvetica"><a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a></font></p>
<br></span></div></span> </div><br></div></div></blockquote></div><br>