Version 1.5 of ais/ai-00378.txt

Unformatted version of ais/ai-00378.txt version 1.5
Other versions for file ais/ai-00378.txt

!standard 11.04.01(10)          04-11-09 AI95-00378/02
!standard 11.04.01(12)
!standard 11.04.01(13)
!class binding interpretation 04-04-20
!status Amendment 200Y 04-07-02
!status WG9 approved 04-11-18
!status ARG Approved 6-0-0 04-06-14
!status work item 04-04-20
!status received 04-04-05
!priority Low
!difficulty Easy
!subject The bounds of Ada.Exceptions.Exception_Name
!summary
The string functions in Ada.Exceptions return strings whose lower bounds are one.
!question
The Standard does not specify the lower bound of the string-returning function Ada.Exceptions.Exception_Name. Most other functions in the standard are specified to return a string based at one. Should this function also be specified that way? (Yes.)
!wording
Add before the last sentence of 11.4.1(10):
In either case, Exception_Message returns a string with lower bound 1.
Add after the first sentence of 11.4.1(12), and after the only sentence of 11.4.1(13):
The returned string has lower bound 1.
!discussion
It's friendlier to return strings that are known to start at 1, and many functions in Ada already have this rule.
This should apply to Exception_Message and Exception_Information as well.
!corrigendum 11.4.1(10)
Replace the paragraph:
Raise_Exception raises a new occurrence of the identified exception. In this case, Exception_Message returns the Message parameter of Raise_Exception. For a raise_statement with an exception_name, Exception_Message returns implementation-defined information about the exception occurrence. Reraise_Occurrence reraises the specified exception occurrence.
by:
Raise_Exception raises a new occurrence of the identified exception. In this case, Exception_Message returns the Message parameter of Raise_Exception. For a raise_statement with an exception_name, Exception_Message returns implementation-defined information about the exception occurrence. In either case, Exception_Message returns a string with lower bound 1. Reraise_Occurrence reraises the specified exception occurrence.
!corrigendum 11.4.1(12)
Replace the paragraph:
The Exception_Name functions return the full expanded name of the exception, in upper case, starting with a root library unit. For an exception declared immediately within package Standard, the defining_identifier is returned. The result is implementation defined if the exception is declared within an unnamed block_statement.
by:
The Exception_Name functions return the full expanded name of the exception, in upper case, starting with a root library unit. The returned string has lower bound 1. For an exception declared immediately within package Standard, the defining_identifier is returned. The result is implementation defined if the exception is declared within an unnamed block_statement.
!corrigendum 11.4.1(13)
Replace the paragraph:
Exception_Information returns implementation-defined information about the exception occurrence.
by:
Exception_Information returns implementation-defined information about the exception occurrence. The returned string has lower bound 1.
!example
!ACATS test
Add test cases to CB41002, CB41003, CB41004 to check that the lower bound is 1.
!appendix

!topic The bounds of Ada.Exceptions.Exception_Name
!reference RM95-11.4.1(12)
!from Gary Dismukes 2004-04-05
!discussion

The RM does not specify the lower bound of the string-returning
function Ada.Exceptions.Exception_Name, so the result string need
not be based at one.  However, the RM often does define other
predefined string-returning functions to return results that are
one-based (e.g., see A.4.3 (2), Fixed-Length String Handling),
and in general it would seem friendlier to define most predefined
string functions to have one-based results (apart from certain cases
such as slice functions).  Even though users should write code that
does not depend on specific lower bounds, the truth is that they
often do.  This issue arose because of a customer who was expecting
to get a one-based result from a GNAT-specific function that returns
an exception's simple name (rather than it's expanded name).

The suggestion is that the Exception_Name functions, as well as
the other string functions in Ada.Exceptions (Exception_Message
and Exception_Information), should have their result lower bound
defined to be one.  Probably most implementations are already
returning results based at one.  In fact GNAT does this as well,
except that the GNAT-specific function to return a simple name
did not.  If there are currently any implementations returning
results not based at one, the change to normalize the lower
bound is a simple one.

****************************************************************


Questions? Ask the ACAA Technical Agent