Version 1.4 of ais/ai-00140.txt

Unformatted version of ais/ai-00140.txt version 1.4
Other versions for file ais/ai-00140.txt

!standard B.3.1 (24)          99-08-31 AI95-00140/02
!class binding interpretation 96-05-07
!status Corrigendum 2000 99-05-27
!status WG9 approved 96-12-07
!status ARG approved 7-0-1 96-06-17
!status work item 96-05-08
!status received 96-05-07
!priority Low
!difficulty Easy
!qualifier Omission
!subject Semantics of Interfaces.C.Strings.To_Char_Ptr when Nul_Check is False
!summary
If Nul_Check is False, Interfaces.C.Strings.To_Char_Ptr performs a pointer conversion with no allocation of memory.
!question
B.3.1(23-24) says:
23 function To_Chars_Ptr (Item : in char_array_access;
Nul_Check : in Boolean := False)
return chars_ptr;
24 If Item is null, then To_Chars_Ptr returns Null_Ptr. Otherwise, if Nul_Check is True and Item.all does not contain nul, then the function propagates Terminator_Error; if Nul_Check is True and Item.all does contain nul, To_Chars_Ptr performs a pointer conversion with no allocation of memory.
This does not seem to cover the case where Nul_Check is False.
!recommendation
(See summary.)
!wording
Change B.3.1(24) to:
24 If Item is null, then To_Chars_Ptr returns Null_Ptr. Otherwise, if Nul_Check is True and Item.all does not contain nul, then the function propagates Terminator_Error. Otherwise, To_Chars_Ptr performs a pointer conversion with no allocation of memory.
Or, equivalently:
24 If Nul_Check is True, Item is non-null, and Item.all does not contain nul, Terminator_Error is propagated. Otherwise, To_Chars_Ptr performs a pointer conversion with no allocation of memory.
!discussion
(See summary.)
!corrigendum B.03.01(24)
Replace the paragraph:
If Item is null, then To_Chars_Ptr returns Null_Ptr. Otherwise, if Nul_Check is True and Item.all does not contain nul, then the function propagates Terminator_Error; if Nul_Check is True and Item.all does contain nul, To_Chars_Ptr performs a pointer conversion with no allocation of memory.
by:
If Item is null, then To_Chars_Ptr returns Null_Ptr. Otherwise, if Nul_Check is True and Item.all does not contain nul, then the function propagates Terminator_Error. Otherwise, To_Chars_Ptr performs a pointer conversion with no allocation of memory.
!ACATS test
A test case was added to ACATS test CXB3009 to check Nul_Check => False in To_Chars_Ptr.
!appendix

!section B.3.1(24)
!subject Semantics of Interfaces.C.Strings.To_Char_Ptr when Nul_Check is False
!reference RM95 B.3.1(24)
!from Pascal Leroy 96-04-29
!reference 96-5528.c Pascal Leroy 96-4-29>>
!discussion

The referenced paragraph describes the semantics of To_Char_Ptr as follows (I
am omitting the details to shows the logical structure):

"If Item is null ... Otherwise if Nul_Check is True and Item.all doesn't
contain nul ...; if Nul_Check is True and Item.all does contain nul ..."

This sentence doesn't appear to cover the case where Nul_Check is False.  Not
that the semantics is hard to guess, but it would be nice if it was explicitly
stated.

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

Questions? Ask the ACAA Technical Agent