Re: Default array base index



On Jan 27, 11:36 am, "Dmitry A. Kazakov" <mail...@xxxxxxxxxxxxxxxxx>
wrote:
Actually both statements are wrong. As an example consider:

Foo : array (Character) of Boo;

Here the base index is neither specified nor 1. It is NUL (character).

Hmm, I would say it is specified explicitly but indirectly, via the
definition of the base type.

However, it does appear that Ada culture leans toward the
use of 1 as a default (for example, the language numbers the
dimensions of the array from 1 in attribute expressions).

Maybe, when index is a signed integer type. But with modular integer types
0 as the lower bound looks quite natural. And for enumeration types the
issue makes no sense anyway.

Okay.

Thanks for the reply.

-- Scott
.



Relevant Pages

  • Re: Default array base index
    ... which claims that the default base index for arrays in Ada is 1. ... Foo: array of Boo; ... when index is a signed integer type. ...
    (comp.lang.ada)
  • Re: strcpy - my implementation
    ... Since you're initialising an array of integers, ... If the type were non-integer (e.g. pointer, or floating point, or struct ... integer type can safely be initialized with memset, ...
    (comp.lang.c)
  • Re: how to "put" a binary structure? (newbie question!)
    ... I'm a newbie to Ada programming and> therefore please excuse if my question might be silly or stupid. ... Array of bits, like array of Boolean or of Bit_T ... Modular integer type mod 2**8, Unsigned_8> How can I correct the source code to print the values stored in the> structure Xxx? ...
    (comp.lang.ada)
  • Re: String or Numeric Variable?
    ... Why bother even having a BYTE type, or an INTEGER type? ... Some VB and Windows functions take Integers, not Longs, i.e. the VB graphic ... IF you have a large array, say 100K or more, then it might make sense to use ... own set of flags. ...
    (comp.lang.basic.visual.misc)
  • Re: Address of an array = address of its 1st element: undecidable question ?
    ... integer type is a subrange of the corresponding ... as well be interpreted as an array of two shorts or an array ... But a reasonable extension of the standard's definition of "value" ...
    (comp.lang.c)