[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: comparing function pointer with int does not produce error



Right, understood, finally.  Thanks.

-----Original Message-----
From: Martin v. Loewis [mailto:martin@v.loewis.de]
Sent: Wednesday, October 24, 2001 8:43 PM
To: mdorey@bluearc.com
Cc: achittenden@bluearc.com; dan@debian.org; gcc-gnats@gcc.gnu.org;
debian-gcc@lists.debian.org; ehughes@bluearc.com
Subject: Re: comparing function pointer with int does not produce error


> I can't disagree with your reading ("involve" doesn't mean "be").
However,
> searching for "integral constant expression" suggests to me that this
> outlaws the following code, all of which compiles without warning:
> 
> enum {dim = 1};
> char a [dim]; // 8.3.4.1

Please note that only null pointer constants are required to be "of
integer type". Not every "integral constant expression" is "of integer
type"; some are of enumeration type. An array bound doesn't need to be
of integer type.

> void* b = new char [1] [dim]; // 5.3.4.6

... nor does the dimension in a new expression ...

> struct Badger
> {
>   static const int i = dim; // 9.4.2.4

... nor the initialization of a static data member of const integral
*or const enumeration type* (notice that, under your interpretation,
it would be disallowed to initialize a const of enumeration type with
an enumerator - this is certainly not intended in C++).

Regards,
Martin


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



Reply to: