[Insight-developers] ITK with SunPro compilers

Miller, James V (Research) millerjv at crd . ge . com
Tue, 3 Sep 2002 11:07:09 -0400


Does this look like the macro we need? I change the suggested name of the macro
from ITK_STATIC_CONST to itkStaticConstMacro to make is consistent with our 
itkSetMacro(), itkNewMacro() etc.


#if defined(_MSC_VER) && (_MSC_VER <= 1300) 
#   define ITK_NO_INCLASS_MEMBER_INITIALIZATION
#endif
#if defined(__SUBPRO_CC) && (__SUNPRO_CC <= 0x520)
#   define ITK_NO_INCLASS_MEMBER_INITIALIZATION
#endif

#ifdef ITK_NO_INCLASS_MEMBER_INITIALIZATION
#     define itkStaticConstMacro(type, assignment) enum { assignment }
#else
#     define itkStaticConstMacro(type, assignment) static const type assignment
#endif

> -----Original Message-----
> From: Brad King [mailto:brad.king@kitware.com]
> Sent: Friday, August 30, 2002 3:27 PM
> To: Miller, James V (Research)
> Cc: Insight Developers; Bill Hoffman
> Subject: RE: [Insight-developers] ITK with SunPro compilers
> 
> 
> > I assume we could away with
> >
> > ITK_CONST_INT(name, value);
> >
> > Should be abstract this a level further? For instance, 
> ITK_INT_TRAIT()
> > or something like that?
> 
> The type might not always be int.  I suggest we follow 
> boost's approach:
> 
> ITK_STATIC_CONST(type, assignment);
> 
> becomes either
> 
> static const type assignment;
> 
> or
> 
> enum { assignment };
> 
> Usage would look like this:
> 
> ITK_STATIC_CONST(int, ImageDimension = VImageDimension);
> ITK_STATIC_CONST(unsigned long, Length = VLength);
> 
> -Brad
>