From rz48@rz.uni-karlsruhe.de  Tue Jul  8 16:42:41 1997
Received: from nz11.rz.uni-karlsruhe.de (nz11.rz.uni-karlsruhe.de [129.13.64.7]) by dkuug.dk (8.6.12/8.6.12) with ESMTP id QAA17409 for <sc22wg5@dkuug.dk>; Tue, 8 Jul 1997 16:42:40 +0200
Message-Id: <199707081442.QAA17409@dkuug.dk>
Received: from ry73.rz.uni-karlsruhe.de by nz11.rz.uni-karlsruhe.de with SMTP (PP); Tue, 8 Jul 1997 16:42:34 +0200
Received: by ry73.rz.uni-karlsruhe.de
	(1.38.193.4/16.2) id AA17131; Tue, 8 Jul 1997 16:42:33 +0200
Subject: Re: (SC22WG5.1412) C enum support
To: sc22wg5@dkuug.dk
Date: Tue, 8 Jul 1997 16:42:33 +0200 (CES)
From: hennecke@rz.uni-karlsruhe.de (Michael Hennecke)
Reply-To: hennecke@rz.uni-karlsruhe.de (Michael Hennecke)
X-Mailer: ELM [version 2.4ME+ PL31 (25)]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 2200      

According to Malcolm Cohen:
> Michael Hennecke said:
> > I do not see any advantage in defining extra kind parameters like
> > C_SCHAR_ENUM. If an enum's type is a signed integer, that integer kind 
> > can be used directly: I expect that C_*_ENUM==C_* for * in SCHAR, SHORT, 
> > INT and LONG and so the C_*_ENUM kinds would not help at all.
> 
> You expectation is incorrect - the C standard allows enum types to be wider
> and it is very common for a compiler to make an enum type effectively "int"
> even though all the values fit into a char/short/whatever.  (On such
> compilers, C_SCHAR_ENUM, C_SHORT_ENUM and C_INT_ENUM would all be equal to
> C_INT).

I think we agree on the interpretation of the C standard.

You seem to interpret C_SHORT_ENUM as "the kind value of an enum type
whose *enumerators* have values which are representable as SHORTs".
I had read this as "the kind value of the *enum* type is SHORT",
which thus could just be C_SHORT. The *type* of the enumerators is
always INT and therefore I missed the point about their value-range...

I agree that even if all enumerators of an enum are representable as SHORT,
the type of the enum may be INT. One problem is that there is no statement
of the form "*all* enums whose enumerators are representable as SHORT will
have the same type XYZ" in the C standard, so I am a bit uncomfortable with 
the above. Something like

  C_SELECTED_ENUM_KIND( (/ type-int-enumerator-list /) )

to support the dependence of the selected enum type on all the actual 
values rather than on the fact that they are representable as SHORT is
more flexible.

Thanks,
Michael

 ======================================================================
  Michael Hennecke      http://www.uni-karlsruhe.de/~Michael.Hennecke/ 
 ----------------------------------------------------------------------
  University of Karlsruhe         RFC822: hennecke@rz.uni-karlsruhe.de 
  Computing Center (G20.21 R210)               No longer on BITNET :-(
  Zirkel 2  *  P.O. Box 69 80                 Phone: +49 721  608-4862 
  D-76128  Karlsruhe                               Fax: +49 721  32550 
 ======================================================================
