[Insight-users] itkStaticConstMacro

Karthik Krishnan karthik.krishnan at kitware.com
Wed Jan 17 17:18:25 EST 2007


On 1/17/07, Dennis Jen <dsjen at nmr.mgh.harvard.edu> wrote:
>
> Hi,
>   When I upgraded from ITK 2.6.0 to 3.0.0, I got a compile error in a
> filter I was working on.  It looks like the itkStaticConstMacro is only
> valid for the integer type now.  This line:
>
>   itkStaticConstMacro( DEFAULT_REPLICA_EXCHANGE_PROBABILITY, double, 0.05)
>
> causes the following error:
>
> MY_PATH/itkPoistatsFilter.h:375: error: enumerator value for
> `DEFAULT_REPLICA_EXCHANGE_PROBABILITY' not integer constant


itkStaticConstMacro should be used only for "unsigned int" and "int" as long
as ITK supports VS6.0, gcc <= 2.95. The change that was made to itkMacro
prompting your error enforced it for all gcc compilers regardless of whether
it was allowed.

The point is that itkStaticConstMacro uses a "static const" on a few
compilers and an "enum" on those where the former doesn't work.  And enum's
are integer enumerations.

So in the interest of portability please do not use itkStaticConstMacro for
doubles.  Just do

  static const double DEFAULT_REPLICA_EXCHANGE_PROBABILITY = 0;

Thanks
-karthik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070117/b85c7313/attachment.htm


More information about the Insight-users mailing list