View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0009426ITKpublic2009-08-15 04:102010-10-21 12:31
ReporterGaetan Lehmann 
Assigned ToBradley Lowekamp 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in VersionITK-3-18 
Summary0009426: ITK_UINT64 and vxl_uint_64 are not a 64bit integer on windows
Descriptionin itkIntType.h we have:

 #ifdef _WIN32
   typedef long ITK_INT64;
 #endif

 #ifdef _WIN32
   typedef unsigned long ITK_UINT64;
 #endif

and vxl_uint_64 is defined as void on vc60.
As a consequence, there is no portable 64bit integer type usable in ITK.
TagsNo tags attached.
Resolution Date
Sprint
Sprint Status
Attached Files? file icon itkIntTypes.h [^] (4,640 bytes) 2009-12-14 12:13

 Relationships
parent of 0010093closedMathieu Malaterre Changes in "itkIntTypes.h" conflict with "gdcmCommon.h" 
related to 0001538closedLuis Ibanez itkIntTypes.h and 64 bits integer type 

  Notes
(0017136)
Luis Ibanez (manager)
2009-08-15 12:20

Instead of the 64 bits types we should use size_t and ptrdiff_t, which will have the largest integer type that can be represented in that architecture.
(unsigned and signed respectively).
(0017160)
Tom Vercauteren (developer)
2009-08-19 09:45

I agree with Luis but in some cases, it is necessary to use integers of known size. For example when using sse functions. We could maybe rely on pstdint.h ( http://www.azillionmonkeys.com/qed/pstdint.h [^] ) for these cases.
(0018191)
Bradley Lowekamp (developer)
2009-10-22 12:04

I agree that in many cases size_t and ptrdiff_t should be used when initially one thinks they need an explicitly 64bit integer.

However, many times:
sizeof(long long) > sizeof( long )
and 32-bit build have 64 bit integers.


Also vxl_uint_64 is defined as void on vc60 because the 64-bit integer is incomplete on this system as it does not behave as expected in term of conversion etc...
(0018846)
Brad King (manager)
2009-12-14 10:18

The attached "itkIntTypes.h" looks pretty good. I have a couple comments:

- KWSYS_CAN_CONVERT_UI64_TO_DOUBLE should be itksys_CAN_CONVERT_UI64_TO_DOUBLE

- The line "typedef uintptr_t uintptr_t;" should be "typedef ::uintptr_t uintptr_t;"

Also, please create a test that verifies type size and signed-ness at runtime.

We should consider looking for <cstdint> and pulling types out of std:: if it is available. This could wait for later though.
(0018895)
Bradley Lowekamp (developer)
2009-12-15 09:25

Committed File:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkIntTypes.h.diff?cvsroot=Insight&r1=1.7&r2=1.8 [^]


And Test:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Testing/Code/Common/itkIntTypesTest.cxx?revision=1.4&root=Insight&view=markup [^]
(0018896)
Brad King (manager)
2009-12-15 09:30

Nice, thanks.
(0018914)
Bradley Lowekamp (developer)
2009-12-16 08:31
edited on: 2009-12-16 08:32

Baffling output of the failing test on VS6:

http://www.cdash.org/CDash/testDetails.php?test=38869515&build=494381 [^]

(0018915)
Brad King (manager)
2009-12-16 08:49

It's because of code like this in the test:

-------------------------------------
template <typename T>
bool CheckSize( size_t size )
{
  return ( sizeof( T ) == size );
}
-------------------------------------

VS6 only includes argument types in mangling and does not account for the template argument. Therefore the linker chooses one symbol for all the instantiations no matter the type. Change it to this:

-------------------------------------
template <typename T>
bool CheckSize( size_t size, T* = 0 )
{
  return ( sizeof( T ) == size );
}
-------------------------------------

Do the same for all the check functions.
(0021130)
Bradley Lowekamp (developer)
2010-06-22 15:19

update itkIntType includes new types which are tested to be of the correct size.

 Issue History
Date Modified Username Field Change
2009-08-15 04:10 Gaetan Lehmann New Issue
2009-08-15 12:20 Luis Ibanez Note Added: 0017136
2009-08-19 09:45 Tom Vercauteren Note Added: 0017160
2009-10-22 12:04 Bradley Lowekamp Note Added: 0018191
2009-10-22 12:04 Bradley Lowekamp Status new => assigned
2009-10-22 12:04 Bradley Lowekamp Assigned To => Bradley Lowekamp
2009-12-04 11:24 Bradley Lowekamp Relationship added related to 0001538
2009-12-11 11:47 Bradley Lowekamp File Added: itkIntTypes.h
2009-12-11 11:50 Bradley Lowekamp File Deleted: itkIntTypes.h
2009-12-11 11:50 Bradley Lowekamp File Added: itkIntTypes.h
2009-12-14 10:18 Brad King Note Added: 0018846
2009-12-14 12:13 Bradley Lowekamp File Deleted: itkIntTypes.h
2009-12-14 12:13 Bradley Lowekamp File Added: itkIntTypes.h
2009-12-15 09:25 Bradley Lowekamp Note Added: 0018895
2009-12-15 09:30 Brad King Note Added: 0018896
2009-12-16 08:31 Bradley Lowekamp Note Added: 0018914
2009-12-16 08:32 Bradley Lowekamp Note Edited: 0018914
2009-12-16 08:32 Bradley Lowekamp Note Edited: 0018914
2009-12-16 08:49 Brad King Note Added: 0018915
2010-01-15 09:38 Bradley Lowekamp Relationship added parent of 0010093
2010-06-22 15:19 Bradley Lowekamp Note Added: 0021130
2010-06-22 15:19 Bradley Lowekamp Status assigned => resolved
2010-06-22 15:19 Bradley Lowekamp Fixed in Version => ITK-3-18
2010-06-22 15:19 Bradley Lowekamp Resolution open => fixed
2010-10-21 12:31 Gabe Hart Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team