Start a conversation

How are Ada arrays with enumerated indices handled? (i.e. Ada allows array indices to start with non-zero, even non-numeric values) How is this mapped to C which must always start at zero?

Enumerated indices are not generally a special case, as enumeration values may be used as indices in C. However, if the Ada enumeration type has an enumeration rep clause which leaves holes in the enumeration sequence, then a table is used to translate the Ada enumeration values to a contiguous sequence of values starting at zero, as needed for indexing. In the general case, the low bound of an Ada array is subtracted out to produce a zero-based array for C indexing. 

Choose files or drag and drop files
Was this article helpful?
  1. MapuSoft

  2. Posted
  3. Updated