Version 1.1 of ai12s/ai12-0135-1.txt

Unformatted version of ai12s/ai12-0135-1.txt version 1.1
Other versions for file ai12s/ai12-0135-1.txt

!standard A.8.1(10)          14-10-09 AI12-0135/01
!standard A.8.2(28/3)
!standard A.8.4(10)
!class Amendment 14-10-09
!status work item 14-10-09
!status received 14-08-18
!priority Low
!difficulty Easy
!subject Enumeration types should be eligible for convention C
** TBD.
It is convenient to map C enumeration types to Ada enumeration types. However, enumeration types are not eligible for convention C. An implementation can allow enumeration types to have convention C via B.1(20), but this depends on the implementer, and thus impacts portability.
Allow enumeration types as eligible for convention C (at least).
** TBD.
For some reason, B.1(12-21/3) do not require any scalar types to be eligible for convention L. Perhaps that is because using the scalar types in the various interface packages is preferred.
That's not sensible in the case of enumeration types, however. Many languages have some type similar to Ada's enumerations, and direct mapping should be supported if possible.
[I don't know whether we should (1) only require such support for C; (2) require such support for all languages where it makes sense; or (3) only require it in some limited case (such as when a size is given for the enumeration type).
Portability says that we ought to support something, but it's unclear if the Ada compiler has enough information to make the correct mapping.
OTOH, most existing Ada compilers (all of the ones I know of for sure) support this capability. It's sad that it's not required.]
No impact.
!ACATS test

!topic Enumeration types should be eligible for convention C
!reference Ada 2012 B.1(14/3)
!from Victor Porton 80-07-21
!keywords convention, C, eligible, enumeration type

Enumeration types should be eligible for convention C.

There is one difficult thing here:

An enumeration type may be declared as having convention C before its
representation values are specified.

So to work around of this, convention C should become effective only
after enumeration representation clause is met or when it is too late.
(Define "too late" precisely. By the way I do not see in the RM when it is
too late for a enumeration representation clause. Should we start and other
correction procedure to specify when enumeration representation clause is
disallowed, because the enumeration values are already used?)

Note that in GNAT enumeration types are already eligible for convention C.


Questions? Ask the ACAA Technical Agent