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


	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.

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