I just tested the following in GCC 3.4.3 and it compiled OK.

enum foo { bar=~0, baz=(~0)-1, boo=(~0)-2 };

Perhaps this is another possibility?
--Matt

-----Original Message-----
From: Alberto Massari [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 11:21 AM
To: [email protected]
Subject: Re: Compiler Warnings for TOP_LEVEL_SCOPE


The issue is that the scope is usually a valid unsigned int (like 1, 2 and 
so on); the enum/define only needs to specify the two special cases. Maybe 
the MAX_INT-1 and MAX_INT-2 could work, but we should be sure to get the 
right MAX_INT value for the current platform...

Alberto

At 14.13 12/06/2005 +0200, Axel Wei� wrote:
>James Berry wrote:
> > When compiling with default warnings on gcc, we get lots of warnings
> > about passing a negative value into an unsigned parameter. These seem
> > all to be generated from a set of defines in Grammer.hpp
> >
> >      enum {
> >           UNKNOWN_SCOPE = -2
> >         , TOP_LEVEL_SCOPE = -1
> >      };
> >
> > And use of these in functions such as this:
> >
> >      virtual const XMLElementDecl* getElemDecl
> >      (
> >          const   unsigned int    uriId
> >          , const XMLCh* const    baseName
> >          , const XMLCh* const    qName
> >          , unsigned int          scope
> >      )   const = 0;
> >
> >
> > How would people feel if we redefined those enums to be large
> > positive integers such as UINT_MAX-1, UINT_MAX-2 or something? Or
> > changing the scope parameter to be signed?
>
>What speaks against using a named enum type for scope?
>
>      enum Scope{
>           UNKNOWN_SCOPE = -2
>         , TOP_LEVEL_SCOPE = -1
>      };
>
>      virtual const XMLElementDecl* getElemDecl
>      (
>          const   unsigned int    uriId
>          , const XMLCh* const    baseName
>          , const XMLCh* const    qName
>          , enum Scope            scope
>      )   const = 0;
>
>                         Axel
>
>--
>Humboldt-Universit�t zu Berlin
>Institut f�r Informatik
>Signalverarbeitung und Mustererkennung
>Dipl.-Inf. Axel Wei�
>Rudower Chaussee 25
>12489 Berlin-Adlershof
>+49-30-2093-3050
>** www.freesp.de **
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
___________________________________________________________________
The information contained in this message and any attachment may be
proprietary, confidential, and privileged or subject to the work
product doctrine and thus protected from disclosure.  If the reader
of this message is not the intended recipient, or an employee or
agent responsible for delivering this message to the intended
recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify me
immediately by replying to this message and deleting it and all
copies and backups thereof.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to