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 Kirk Wylie <ki...@kidar.org> on 2000/09/09 00:41:53 UTC

Patch: Reordered member variables in ThrowEOEJanitor

This is another issue which comes up compiling in g++ 2.95.2 on
intel/Linux, with -Wall (i.e. compiling a client program, not
necessarily Xerces itself).

ReaderManager.hpp defines a class, ThrowEOEJanitor. It is using
constructor initialization of its two member variables. However, those
are out of the order specified in the class definition itself. Thus g++
wants to reorder them, and the warning indicates that it will do so.

This patch resolves that warning, and silences g++ when compiling client
programs with -Wall. It does so by reordering the constructors to match
what g++ expects. Because the two member variables are primitives (a
bool and a pointer) there is no problem with reordering their
initializers.

Applied to .../xml-xerces/c/src with current HEAD revision.

Kirk Wylie
-- 
Kirk Wylie  |  mailto:kirk@radik.com  |  http://www.radik.com

Re: Patch: Reordered member variables in ThrowEOEJanitor

Posted by Andy Heninger <an...@jtcsv.com>.
Done.  Thanks for pointing these out.

Andy Heninger
IBM XML Technology Group, Cupertino, CA
heninger@us.ibm.com



----- Original Message -----
From: "Kirk Wylie" <ki...@kidar.org>
To: <xe...@xml.apache.org>
Sent: Friday, September 08, 2000 3:41 PM
Subject: Patch: Reordered member variables in ThrowEOEJanitor


> This is another issue which comes up compiling in g++ 2.95.2 on
> intel/Linux, with -Wall (i.e. compiling a client program, not
> necessarily Xerces itself).
>
> ReaderManager.hpp defines a class, ThrowEOEJanitor. It is using
> constructor initialization of its two member variables. However, those
> are out of the order specified in the class definition itself. Thus g++
> wants to reorder them, and the warning indicates that it will do so.
>
> This patch resolves that warning, and silences g++ when compiling client
> programs with -Wall. It does so by reordering the constructors to match
> what g++ expects. Because the two member variables are primitives (a
> bool and a pointer) there is no problem with reordering their
> initializers.
>
> Applied to .../xml-xerces/c/src with current HEAD revision.
>
> Kirk Wylie
> --
> Kirk Wylie  |  mailto:kirk@radik.com  |  http://www.radik.com


--------------------------------------------------------------------------
------


> Index: internal/ReaderMgr.hpp
> ===================================================================
> RCS file: /home/cvspublic/xml-xerces/c/src/internal/ReaderMgr.hpp,v
> retrieving revision 1.11
> diff -u -r1.11 ReaderMgr.hpp
> --- internal/ReaderMgr.hpp 2000/07/08 00:17:13 1.11
> +++ internal/ReaderMgr.hpp 2000/09/08 16:46:39
> @@ -420,8 +420,8 @@
>





// -----------------------------------------------------------------------
>      ThrowEOEJanitor(ReaderMgr* mgrTarget, const bool newValue) :
>
> -        fMgr(mgrTarget)
> -        , fOld(mgrTarget->getThrowEOE())
> +        fOld(mgrTarget->getThrowEOE())
> +        , fMgr(mgrTarget)
>      {
>          mgrTarget->setThrowEOE(newValue);
>      }
>
>