[Insight-developers] Sun Compiler

Miller, James V (Research) millerjv at crd.ge.com
Mon Nov 8 09:46:38 EST 2004


This suggestion works for me.  I would not want to go to passing "double*"
which is where I thought you were heading.

Jim


-----Original Message-----
From: William A. Hoffman [mailto:billlist at nycap.rr.com]
Sent: Friday, November 05, 2004 3:07 PM
To: Miller, James V (Research); Lorensen, William E (Research);
insight-developers at itk.org
Subject: RE: [Insight-developers] Sun Compiler


I think the better approach would be to qualify the name:

template <int VD>
struct A
{
static const int Dimension = VD;
void Method(double v[Dimension]);
};

template <int VD> void A<VD>::Method(double v[A::Dimension]) {}

The above code works on gcc 3.4, como, SGI CC, VS 6,7,7.1, and borland.
If you want to try it on your favorite compiler, then let me know if it
does not work.


-Bill



At 01:19 PM 11/5/2004, Miller, James V (Research) wrote:
>I would go the other route.  Instead of replacing array[size] with
>array*, I would replace array[size] with some ArrayType typedef.
>
>Jim
>
>-----Original Message-----
>From: William A. Hoffman [mailto:billlist at nycap.rr.com]
>Sent: Friday, November 05, 2004 1:12 PM
>To: Lorensen, William E (Research); insight-developers at itk.org
>Subject: RE: [Insight-developers] Sun Compiler
>
>
>This shows up in more than one place.   If this is the solution that we
>want to use, then I can try making the change.   Should we change all
>arguments of type array[size] to array* ?
>I suppose this should not break anything, and I don't thing the wrapping
>takes advantage of the specified size.
>
>-Bill
>
>
>At 11:53 AM 11/5/2004, Lorensen, William E (Research) wrote:
>>With that change, itkPointSet.txx builds fine with Borland.
>>
>>Bill
>>
>>-----Original Message-----
>>From: William A. Hoffman [mailto:billlist at nycap.rr.com]
>>Sent: Friday, November 05, 2004 11:03 AM
>>To: Lorensen, William E (Research); Lorensen, William E (Research);
>>insight-developers at itk.org
>>Subject: RE: [Insight-developers] Sun Compiler
>>
>>
>>OK, I tried the static const thing and it still did not really work.
>>I think the problem is mainly of scope.  It would seem that the current CC
>>on the sun supports int template parameters.  However, it seems to have
>>some different scope rules.   
>>
>>// compiles:
>>::FindClosestPoint(CoordRepType[PointSet::PointDimension],
>>                   PointIdentifier*)
>>
>>// does not compile, says you need an int 
>>::FindClosestPoint(CoordRepType[PointDimension],
>>                   PointIdentifier*)
>> 
>>-Bill
>>
>>
>>At 10:12 AM 11/5/2004, Lorensen, William E (Research) wrote:
>>>VPointDimension is not available in all of the places that are failing.
>>>
>>>-----Original Message-----
>>>From: William A. Hoffman [mailto:billlist at nycap.rr.com]
>>>Sent: Friday, November 05, 2004 9:07 AM
>>>To: Lorensen, William E (Research); insight-developers at itk.org
>>>Subject: RE: [Insight-developers] Sun Compiler
>>>
>>>
>>>I don't think this has anything to do with INCLASS member initialization.
>>>It is this line that causes the problem:  CoordRepType[PointDimension]
>>>There are no defines on that line.  The problem is that it does not think
>>>PointDimension is an int.   If you use the template parameter
>>>VPointDimension
>>>it works.
>>>
>>>-Bill
>>>
>>>At 07:25 AM 11/5/2004, Lorensen, William E (Research) wrote:
>>>>In itkMacro.h these is code:
>>>>
>>>>#if defined(_MSC_VER) && (_MSC_VER <= 1300) 
>>>>#   define ITK_NO_INCLASS_MEMBER_INITIALIZATION
>>>>#endif
>>>>#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x540)
>>>>#   define ITK_NO_INCLASS_MEMBER_INITIALIZATION
>>>>#endif
>>>>#if defined(__SVR4) && !defined(__SUNPRO_CC)
>>>>#   define ITK_NO_INCLASS_MEMBER_INITIALIZATION
>>>>#endif
>>>>
>>>>Looks like some magic may be required for the sun compiler. Can you
check
>>>to
>>>>see if the define is being executed for the native sun compiler. If so,
>>>>maybe it should not be?
>>>>
>>>>Bill
>>>>
>>>>-----Original Message-----
>>>>From: William A. Hoffman [mailto:billlist at nycap.rr.com]
>>>>Sent: Thursday, November 04, 2004 10:09 PM
>>>>To: insight-developers at itk.org
>>>>Subject: [Insight-developers] Sun Compiler
>>>>
>>>>
>>>>We have a new sun at Kitware and I thought I would give the native
>>compiler
>>>>a go.
>>>>Here are the errors:
>>>>
>>>>http://www.itk.org/Testing/Sites/dashsun1/SunOS-CC/20041104-2212-Experim
e
>n
>>t
>>>a
>>>>l/BuildError.html
>>>>
>>>>The majority of errors come from this type of thing:
>>>>
>>>>"/.../Insight/Code/Common/itkPointSet.txx", line 299: Error: An integer
>>>>constant expression is required within the array subscript operator.
>>>>1 Error(s) detected.
>>>>*** 
>>>>
>>>>template <typename TPixelType, unsigned int VDimension, typename
>>>>TMeshTraits>
>>>>bool
>>>>PointSet<TPixelType, VDimension, TMeshTraits>
>>>>::FindClosestPoint(CoordRepType[PointDimension],
>>>>                   PointIdentifier*)
>>>>{
>>>>
>>>>The compiler does not like PointDimension, but if you change it to
>>>>VDimension it compiles.
>>>>Is this some sort of strange thing for the borland compiler?
>>>>
>>>>-Bill
>>>>
>>>>
>>>>_______________________________________________
>>>>Insight-developers mailing list
>>>>Insight-developers at itk.org
>>>>http://www.itk.org/mailman/listinfo/insight-developers
>>>>_______________________________________________
>>>>Insight-developers mailing list
>>>>Insight-developers at itk.org
>>>>http://www.itk.org/mailman/listinfo/insight-developers 
>>>_______________________________________________
>>>Insight-developers mailing list
>>>Insight-developers at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-developers 
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers 


More information about the Insight-developers mailing list