[Insight-developers] Borland C++ compiler and enums
Miller, James V (CRD)
millerjv@crd.ge.com
Mon, 4 Feb 2002 09:43:07 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C1AD8A.42AB4FE0
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C1AD8A.42AB4FE0"
------_=_NextPart_001_01C1AD8A.42AB4FE0
Content-Type: text/plain;
charset="iso-8859-1"
We have identified the source of many of the errors when we build ITK with the Borland compiler.
Here is a snippet of
code
template <class TScalarType=double, unsigned int NDimensions=3>
class foo
{
enum { SpaceDimension = NDimensions,
ParametersDimension = NDimensions };
typedef Point<TScalarType, SpaceDimensions> InputPointType;
OutputPointType TransformPoint(const InputPointType &point ) const;
}
When compiling TransformPoint, the Borland compiler uses a Point<double, 0> as the argument instead
of a Point with the proper dimension.
The Boost web site says the Borland compiler does not recognize an enum as an integral type
unless it is fully qualified. If we replace the point typedef with
typedef Point<TScalarType, ::itk::ScaleTransform::SpaceDimension> InputPointType;
everything works, and if we use the template parameter directly, i.e.
typedef Point<TScalarType, NDimensions> InputPointType;
everything works.
Does anyone know a work around for this problem? If we use the template parameter directly, then we
loose some
the context of whether something is a particular dimension because of the its "space" vs its
"parameterization". Fully spec'ing out the enum wherever it is used seems to be quite a hassle.
Is it worth the effort to get the Borland compiler to build Insight? Since it is a free compiler,
supporting it may allow more students to use the toolkit.
Jim Miller
_____________________________________
Visualization & Computer Vision
GE Corporate Research & Development
Bldg. KW, Room C218B
P.O. Box 8, Schenectady NY 12301
millerjv@crd.ge.com < mailto:millerjv@crd.ge.com <mailto:millerjv@crd.ge.com> >
(518) 387-4005, Dial Comm: 8*833-4005,
Cell: (518) 505-7065, Fax: (518) 387-6981
------_=_NextPart_001_01C1AD8A.42AB4FE0
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=766013014-04022002><FONT size=2>We have identified the source
of many of the errors when we build ITK with the Borland compiler.
Here is a snippet of</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2>code</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2> </FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2>template <class
TScalarType=double, unsigned int NDimensions=3><BR>class
foo</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2>{</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2> enum {
SpaceDimension =
NDimensions,<BR>
ParametersDimension = NDimensions
};<BR></DIV></FONT></SPAN>
<DIV><SPAN class=766013014-04022002><FONT size=2> typedef
Point<TScalarType, SpaceDimensions>
InputPointType;<BR></FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT
size=2> OutputPointType TransformPoint(const
InputPointType &point ) const;<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2>When compiling TransformPoint,
the Borland compiler uses a Point<double, 0> as the argument instead of a
Point with the proper dimension.</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2>The Boost web site says the
Borland compiler does not recognize an enum as an integral
type</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2>unless it is fully
qualified. If we replace the point typedef with</FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2> typedef Point<TScalarType,
::itk::ScaleTransform::SpaceDimension>
InputPointType;</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2></FONT></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2>everything works, and if we use the
template parameter directly, i.e.</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2></FONT></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><SPAN class=766013014-04022002><FONT size=2>
typedef Point<TScalarType, NDimensions>
InputPointType;</FONT></SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><SPAN class=766013014-04022002><FONT
size=2></FONT></SPAN></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><SPAN class=766013014-04022002><FONT size=2>everything
works.</DIV>
<DIV><BR></DIV></FONT></SPAN></SPAN></FONT></SPAN>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2>Does anyone know a work around for this
problem? If we use the template parameter directly, then we loose
some</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2>the context of whether something is a
particular dimension because of the its "space" vs its "parameterization". Fully
spec'ing out the enum wherever it is used seems to be quite a
hassle.</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2></FONT></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=766013014-04022002><FONT size=2><SPAN
class=766013014-04022002><FONT size=2>Is it worth the effort to get the Borland
compiler to build Insight? Since it is a free compiler, supporting it may
allow more students to use the toolkit.</DIV>
<DIV><BR></DIV></FONT></SPAN></FONT></SPAN><BR>
<P><B><FONT face="Comic Sans MS" color=#000080>Jim Miller</FONT></B>
<BR><B><I><FONT face=Arial color=#ff0000
size=2>_____________________________________</FONT></I></B><I></I><BR><I></I><I><FONT
face=Arial color=#000000 size=1>Visualization & Computer Vision<BR>GE
Corporate Research & Development<BR>Bldg. KW, Room C218B<BR>P.O. Box 8,
Schenectady NY 12301<BR><BR></FONT><U><FONT face=Arial color=#0000ff
size=1>millerjv@crd.ge.com <<A
href="mailto:millerjv@crd.ge.com">mailto:millerjv@crd.ge.com</A>></FONT></U></I><BR><I><FONT
face=Arial color=#000000 size=1>(518) 387-4005, Dial Comm: 8*833-4005,
</FONT></I><BR><I><FONT face=Arial color=#000000 size=1>Cell: (518) 505-7065,
Fax: (518) 387-6981</FONT></I> </P><BR>
<DIV> </DIV></BODY></HTML>
------_=_NextPart_001_01C1AD8A.42AB4FE0--
------_=_NextPart_000_01C1AD8A.42AB4FE0
Content-Type: application/octet-stream;
name="Miller, James V (CRD).vcf"
Content-Disposition: attachment;
filename="Miller, James V (CRD).vcf"
BEGIN:VCARD
VERSION:2.1
N:Miller;James
FN:Miller, James V (CRD)
ORG:CRD;ESL
TITLE:Computer Scientist
TEL;WORK;VOICE:*833-4005
TEL;WORK;VOICE:1 518 387-4005
ADR;WORK:;KW-C218B;P.O. Box 8;Schenectady;New York;12301;USA
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:KW-C218B=0D=0AP.O. Box 8=0D=0ASchenectady, New York 12301=0D=0AUSA
EMAIL;PREF;INTERNET:millerjv@crd.ge.com
REV:20010420T140329Z
END:VCARD
------_=_NextPart_000_01C1AD8A.42AB4FE0--