[Insight-developers] Fixed width integer types, itkIntTypes, and portable 64-bit integer

Bradley Lowekamp blowekamp at mail.nih.gov
Fri Dec 4 12:03:33 EST 2009


Hello all again,

There are a couple of bug on this topic:
http://www.itk.org/Bug/view.php?id=9426
http://www.itk.org/Bug/view.php?id=1538

There are significant problem with the definitions in following file:
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkIntTypes.h?revision=1.7&root=Insight&view=markup

ITK needs portable fixed with integer types. The complication is that several systems do not have a usable 64-bit integer, so addition preprocessor conditionals are required. This is not a new problem nor is it unsolved, but it's a challenge to get a solution working correct everywhere ( especially with apple's universal builds ). 

There are currently 3 implementation of this which ITK could use:

1) Utilities/vxl/core/vxl_confix.h.in

which defines types like: vxl_int_8, vxl_sint_32 etc.

2) Utilities/kwsys/FundamentalType.h.in

which defines type integer types like: kwsysFundamentalType_UInt32, kwsysFundamentalType_Int32

3) C99 stdint.h with a modified version of pstdint.h when needed

 http://en.wikipedia.org/wiki/Stdint.h
In the downloads notes, it lists the compilers pstdint.h was tested with ( we have more though ).
VXL already has a system to test for well behave header files and replace them on a system by system basis if needed, the use of pstdint is very similar.


So the issue remains:

What do we do with erroneous itkIntTypes.h?

The types are not defined in a very itk like way; they are in all caps, in the global namespace, and the odd use of extern "C" for typedefs. The only place these are used are in the itkMersenneTwisterRandomVariateGenerator.h. Also itkMathDetail uses vnl_int64.

My though is to deprecate the types in itkIntType.h, so that it prints a warning if it's include indicating the types were error prone, and there are new type which should be used instead. 

Then two define new itk types based on 1 or 2. 

Alternatives  for new types to use include:
Just use the C99 types, but I'd estimate that would be more work to get that to work on every compiler. 
Just use vxl types.

Thoughts and comments?

Brad

========================================================
Bradley Lowekamp  
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091204/1e133ff0/attachment.htm>


More information about the Insight-developers mailing list