comp.lang.ada
 help / color / mirror / Atom feed
From: "Dan'l Miller" <optikos@verizon.net>
Subject: Re: 'Size hack for enumerated types
Date: Tue, 8 Jul 2014 07:53:13 -0700 (PDT)
Date: 2014-07-08T07:53:13-07:00	[thread overview]
Message-ID: <d2272863-c1e4-4130-a767-eb6fdd61e14b@googlegroups.com> (raw)
In-Reply-To: <lytx6scowp.fsf@pushface.org>

On Tuesday, July 8, 2014 2:04:06 AM UTC-5, Simon Wright wrote:
> Victor Porton writes:
> > Simon Wright wrote:
> > No reason to assume either of:
> > 1. Ada enumeration is compatible with C int/enum.

In ISO 14882 C++2011 (a.k.a. C++11 for the Y2K-challenged living 2000 years ago) enums are no longer all of type int (or any other mishmash of interpretations and proprietary extensions.  In C++2011 the following is now legal syntax & semantics:

enum Flag_Type : unsigned char { Libxml_Error_Save, Libxml_Structured_Error_Save, URI_Interning, WWW_Skip_Init_Finish};

as depicted at section 3.2 on page 8 of:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf

Because of the postfix "integralType identifier : bitsize" syntax after the identifier being declared in C & C++ for bitfields (and the lack of any declaration of identifier between enum and { here), there is no way in C++2011 to specify the underlying type of an enum to be a bit-field, as seems to be the desire in the Ada analogue along this thread.

> > 2. Ada enumeration is eligible for the specified convention (the
> > convention C).
>
> > This is a work for a future standard.
> > It seems that the current one does not assert neither 1 neither 2. :-(
> 
> Well, try submitting it to the ARG. I expect you'll get rebuffed in
> short order.

If the ARG is truly committed to interoperability with C & C++, then the ARG must seriously pursue accommodating N2347 and any other evolutions of C & C++ feature-set.  If the ARG rebuffs this, then repeatedly rebuff the rebuffing until seamless interoperability is achieved between Ada and C and between Ada & C++.

Conversely, ISO 9899 C2011 does not allow this new language feature, as shown in section 6.4.4.3 on page 67 of http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf.  So perhaps ARG needs to seriously consider adding Convention => C_Plus_Plus or whatever its syntax would be to handle the increasing divergence between C++ and C standards.

  parent reply	other threads:[~2014-07-08 14:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 20:32 'Size hack for enumerated types Victor Porton
2014-07-05 21:47 ` Simon Wright
2014-07-05 22:11   ` Victor Porton
2014-07-05 22:18     ` Victor Porton
2014-07-05 22:23       ` Victor Porton
2014-07-06 16:25         ` Victor Porton
2014-07-06 20:59       ` Simon Wright
2014-07-06 23:01         ` Victor Porton
2014-07-06 23:30           ` Jeffrey Carter
2014-07-07 16:00             ` Victor Porton
2014-07-07 17:12               ` Simon Wright
2014-07-07 20:23                 ` Victor Porton
2014-07-08  7:04                   ` Simon Wright
2014-07-08 10:17                     ` sbelmont700
2014-07-08 14:53                     ` Dan'l Miller [this message]
2014-07-08 20:56                       ` Randy Brukardt
2014-07-08 22:26                         ` Dan'l Miller
2014-07-08 23:18                         ` Jeffrey Carter
2014-07-08  9:43                   ` AdaMagica
2014-07-08 13:52                     ` Victor Porton
2014-07-08 15:02                       ` Simon Wright
2014-07-07  7:45           ` Simon Wright
2014-07-06  7:22     ` Simon Wright
2014-07-06 13:21 ` sbelmont700
2014-07-06 16:16   ` Victor Porton
2014-07-06 17:52     ` sbelmont700
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox