[Insight-developers] Nonportable Code
Peter Cech
pcech at vision.ee.ethz.ch
Sun Aug 16 09:37:27 EDT 2009
On Fri, Aug 14, 2009 at 01:21:41PM -0400, Sean McBride wrote:
> On 8/14/09 6:56 PM, Gaëtan Lehmann said:
>
> >I've used that option, but I'm quite sure the types defined there are
> >wrong.
> >For example,
> >
> > #ifdef _WIN32
> > typedef long ITK_INT64;
> > #endif
> >
> >and
> >
> > #ifdef _WIN32
> > typedef unsigned long ITK_UINT64;
> > #endif
> >
> >don't like right to me.
>
> Agreed.
>
> >Tom's way - vxl_int_64 - seems to be a better option.
> >
> >Should we fix the content of itkIntType.h by using vxl_int_64 types?
> >And do we even need itkIntType.h?
>
> This whole issue of fixed size types was solved and standardised with
> C99 (ISO/IEC 9899:1999), see:
> <http://en.wikipedia.org/wiki/Stdint.h>
>
> I know ITK is C++, not C. Anyone know if the next C++ standard C++-0x
> will incorporate those types from C99?
>
> If so, seems to me we should use int32_t instead of creating an
> INT_INT32. (I know some compilers do not have stdint.h, but we can
> create compatible typedefs in those cases.)
Include cstdint is part of Technical Report 1 (TR1), so it's reasonable
to expect any recent compiler to support it (and some older ones allow
stdint.h to be used in C++ as well). For the oldest compilers, the above
mentioned solution with typedefs will work nicely.
Regards,
Peter Cech
More information about the Insight-developers
mailing list