You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Robert Schiele <rs...@uni-mannheim.de> on 2002/05/08 19:15:41 UTC

INFINITY used as enum member (Bug #8301)

Hello everybody,

On April, 19th I sent a bug report that mentioned that INFINITY is
used as an enum member in
src/xercesc/validators/schema/SchemaSymbols.hpp.  As there was no
reaction upon my bug report since that date, I want to bring up an
argumentation, why in my opinion this should be changed as soon as
possible.

In the ISO C99 standard document section 7.12 INFINITY is explicitly
reserved to be a macro from math.h expanding to the infinity value of
type float.

As long as Xerces-c uses INFINITY as an enum member, applications will
not compile, when they include both math.h and SchemaSymbols.hpp on
ISO C99 compliant systems. As it is expected that in the future more
and more systems will support ISO C99, this member must be renamed or
a ugly workaround like a "#undef INFINITY" is needed.

As people get used to a name more and more, the longer it exists, I
think this renaming should be done as soon as possible. I have no
special idea, what the name of the member should be, as I have no
experience with schema support, but I think this should be discussed
now, to be easily fixed, as soon as an agreement about the new name
has been reached.

Robert

-- 
Robert Schiele			Tel.: +49-621-181-2583
Dipl.-Wirtsch.informatiker	mailto:rschiele@uni-mannheim.de

Re: INFINITY used as enum member (Bug #8301)

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Fix is in CVS.

Khaled

Robert Schiele wrote:

> On Wed, May 08, 2002 at 01:57:52PM -0400, Khaled Noaman wrote:
> > Oops. I did not check the samples. Then, we need to modify the SEnum sample. Your
> > fix looks ok.
>
> Ok, in that case you or someone different should check it in, as I do
> not have write permission.
>
> Robert
>
> --
> Robert Schiele                  Tel.: +49-621-181-2583
> Dipl.-Wirtsch.informatiker      mailto:rschiele@uni-mannheim.de
>
>   ------------------------------------------------------------------------
>    Part 1.2Type: application/pgp-signature


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: INFINITY used as enum member (Bug #8301)

Posted by Robert Schiele <rs...@uni-mannheim.de>.
On Wed, May 08, 2002 at 01:57:52PM -0400, Khaled Noaman wrote:
> Oops. I did not check the samples. Then, we need to modify the SEnum sample. Your
> fix looks ok.

Ok, in that case you or someone different should check it in, as I do
not have write permission.

Robert

-- 
Robert Schiele			Tel.: +49-621-181-2583
Dipl.-Wirtsch.informatiker	mailto:rschiele@uni-mannheim.de

Re: INFINITY used as enum member (Bug #8301)

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Oops. I did not check the samples. Then, we need to modify the SEnum sample. Your
fix looks ok.

Khaled

Robert Schiele wrote:

> On Wed, May 08, 2002 at 01:19:05PM -0400, Khaled Noaman wrote:
> > Hi Robert,
> >
> > We understand your concern. We have looked into the problem, and in fact that
> > enum value is not used anywhere. So, we will remove it from SchemaSymbols.hpp.
>
> Wow, that was a _real_ fast response.
>
> But unfortunately it _is_ used in samples/SEnumVal/SEnumVal.cpp.
> Should the if-case just be removed? Does the following patch fix the
> sample in a correct manner?
>
> --- samples/SEnumVal/SEnumVal.cpp
> +++ samples/SEnumVal/SEnumVal.cpp       Wed May  8 19:44:43 2002
> @@ -307,21 +307,14 @@
>                         cout << "Misc. Flags:\t";
>                 }
>
> -               if( mflags == SchemaSymbols::INFINITY  )
> -               {
> -                       cout << "Infinity ";
> -               }
> -               else
> -               {
> -                       if ( mflags & SchemaSymbols::NILLABLE  != 0 )
> -                               cout << "Nillable ";
> +               if ( mflags & SchemaSymbols::NILLABLE  != 0 )
> +                       cout << "Nillable ";
>
> -                       if ( mflags & SchemaSymbols::ABSTRACT  != 0 )
> -                               cout << "Abstract ";
> +               if ( mflags & SchemaSymbols::ABSTRACT  != 0 )
> +                       cout << "Abstract ";
>
> -                       if ( mflags & SchemaSymbols::FIXED     != 0 )
> -                               cout << "Fixed ";
> -               }
> +               if ( mflags & SchemaSymbols::FIXED     != 0 )
> +                       cout << "Fixed ";
>
>                 if( mflags !=0 )
>                 {
>
> Robert
>
> --
> Robert Schiele                  Tel.: +49-621-181-2583
> Dipl.-Wirtsch.informatiker      mailto:rschiele@uni-mannheim.de
>
>   ------------------------------------------------------------------------
>    Part 1.2Type: application/pgp-signature


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: INFINITY used as enum member (Bug #8301)

Posted by Robert Schiele <rs...@uni-mannheim.de>.
On Wed, May 08, 2002 at 01:19:05PM -0400, Khaled Noaman wrote:
> Hi Robert,
> 
> We understand your concern. We have looked into the problem, and in fact that
> enum value is not used anywhere. So, we will remove it from SchemaSymbols.hpp.

Wow, that was a _real_ fast response.

But unfortunately it _is_ used in samples/SEnumVal/SEnumVal.cpp.
Should the if-case just be removed? Does the following patch fix the
sample in a correct manner?

--- samples/SEnumVal/SEnumVal.cpp
+++ samples/SEnumVal/SEnumVal.cpp	Wed May  8 19:44:43 2002
@@ -307,21 +307,14 @@
 			cout << "Misc. Flags:\t";
 		}
 
-		if( mflags == SchemaSymbols::INFINITY  )
-		{
-			cout << "Infinity ";
-		}
-		else
-		{
-			if ( mflags & SchemaSymbols::NILLABLE  != 0 )
-				cout << "Nillable ";
+		if ( mflags & SchemaSymbols::NILLABLE  != 0 )
+			cout << "Nillable ";
 
-			if ( mflags & SchemaSymbols::ABSTRACT  != 0 )
-				cout << "Abstract ";
+		if ( mflags & SchemaSymbols::ABSTRACT  != 0 )
+			cout << "Abstract ";
 
-			if ( mflags & SchemaSymbols::FIXED     != 0 )
-				cout << "Fixed ";
-		}
+		if ( mflags & SchemaSymbols::FIXED     != 0 )
+			cout << "Fixed ";
 
 		if( mflags !=0 )
 		{

Robert

-- 
Robert Schiele			Tel.: +49-621-181-2583
Dipl.-Wirtsch.informatiker	mailto:rschiele@uni-mannheim.de

Re: INFINITY used as enum member (Bug #8301)

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Hi Robert,

We understand your concern. We have looked into the problem, and in fact that
enum value is not used anywhere. So, we will remove it from SchemaSymbols.hpp.

Khaled

Robert Schiele wrote:

> Hello everybody,
>
> On April, 19th I sent a bug report that mentioned that INFINITY is
> used as an enum member in
> src/xercesc/validators/schema/SchemaSymbols.hpp.  As there was no
> reaction upon my bug report since that date, I want to bring up an
> argumentation, why in my opinion this should be changed as soon as
> possible.
>
> In the ISO C99 standard document section 7.12 INFINITY is explicitly
> reserved to be a macro from math.h expanding to the infinity value of
> type float.
>
> As long as Xerces-c uses INFINITY as an enum member, applications will
> not compile, when they include both math.h and SchemaSymbols.hpp on
> ISO C99 compliant systems. As it is expected that in the future more
> and more systems will support ISO C99, this member must be renamed or
> a ugly workaround like a "#undef INFINITY" is needed.
>
> As people get used to a name more and more, the longer it exists, I
> think this renaming should be done as soon as possible. I have no
> special idea, what the name of the member should be, as I have no
> experience with schema support, but I think this should be discussed
> now, to be easily fixed, as soon as an agreement about the new name
> has been reached.
>
> Robert
>
> --
> Robert Schiele                  Tel.: +49-621-181-2583
> Dipl.-Wirtsch.informatiker      mailto:rschiele@uni-mannheim.de
>
>   ------------------------------------------------------------------------
>    Part 1.2Type: application/pgp-signature


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org