This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: enums and null pointer constants


On Mon, May 22, 2000 at 06:22:11PM -0400, Richard Kenner wrote:
> 	An integer constant expression with the value 0, or such an
> 	expression cast to type void *, is called a null pointer constant.
> 
>     also section 6.6 para 6:
> 
> 	An /integer constant expression/ shall have integer type and
> 	shall only have operands that are integer constants,
> 	*enumeration constants*, character constants, sizeof expressions
> 	whose results are integer constants, and floating constants
> 	that are the immediate operands of casts.
> 
>     // = italics in standard, ** = my emphasis.
> 
>     Taken together, I believe this means that an enum with value 0 is to
>     be considered a null pointer constant, so the comment and the build1
>     operation are incorrect.
> 
> I disagree.  It clearly says an integer constant expression shall
> have integer type.  It is only its *operand* that can be enumeration
> constants.  The expression itself cannot have an enumeration type.

Ah, but an enumeration type _is_ an integer type.  6.2.5 para 17:

	The type char, the signed and unsigned integer types, and the
	enumerated types are collectively called integer types.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]