I wonder to what degree we can count on MAX_INT? I guess we could
define it to 2^(sizeof(int)*4-1) if MAX_INT is not available. Or
simply pick a sufficiently large sentinel value if MAX_INT is not
defined. It simply has to be out of the range of any reasonable scope
count.
-jdb
On Jun 13, 2005, at 11:20 AM, Alberto Massari wrote:
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]