diff --git a/content/courses/intro-to-ada/chapters/standard_library_strings.rst b/content/courses/intro-to-ada/chapters/standard_library_strings.rst index 1e3800039..68d7117a1 100644 --- a/content/courses/intro-to-ada/chapters/standard_library_strings.rst +++ b/content/courses/intro-to-ada/chapters/standard_library_strings.rst @@ -17,7 +17,27 @@ text processing. Ada offers alternative approaches for these cases: - *Unbounded strings*: similar to bounded strings, unbounded strings can contain strings of varied length. However, in addition to that, they don't - have a maximum length. In this sense, they are very flexible. + require a maximum length to be specified at the declaration of a string. In + this sense, they are very flexible. + +.. admonition:: For further reading... + + Although we don't specify a maximum length for unbounded strings, the + limit is :arm:`defined by the Reference Manual `: + + An object of type :ada:`Unbounded_String` represents a :ada:`String` + whose low bound is 1 and whose length can vary conceptually between 0 + and :ada:`Natural'Last`. + + Therefore, the implicit maximum length is :ada:`Natural'Last`. In + contrast, bounded strings have an explicit maximum length that is specified + when the :ada:`Generic_Bounded_Length` package is instantiated (as we'll + see :ref:`later on `). + + Another difference between bounded and unbounded strings is the strategy + that is used by the compiler to allocate memory for those strings. When + using GNAT, bounded strings are allocated on the stack, while unbounded + strings are allocated on the heap. The following sections present an overview of the different string types and common operations for string types.