CVS difference for ais/ai-00242.txt

Differences between 1.1 and version 1.2
Log of other versions for file ais/ai-00242.txt

--- ais/ai-00242.txt	2000/10/05 02:47:31	1.1
+++ ais/ai-00242.txt	2001/10/19 01:36:44	1.2
@@ -1,12 +1,4 @@
-!standard B.3.1 (18)                                  00-10-04  AI95-00242/01
-!standard B.3.1 (19)
-!standard B.3.1 (43)
-!standard B.3.1 (45)
-!standard B.3.1 (46)
-!standard B.3.1 (47)
-!standard B.3.1 (48)
-!standard B.3.1 (49)
-!standard B.3.1 (50)
+!standard B.3.1 (50)                                  01-10-18  AI95-00242/02
 !class binding interpretation 00-10-04
 !status work item 00-10-04
 !status received 00-10-04
@@ -18,7 +10,6 @@
 !summary
 
 Interfaces.C.Strings.Update should support a nul-terminated Chars parameter.
-Interfaces.C.Strings.Update should have a Truncate parameter.
 
 !question
 
@@ -46,7 +37,7 @@
 the Cs variable would indicate a char* string now containing the
 string "WXYZ" with an appended nul.
 
-This is not the case however. RM95 requires that the Update procedure
+This is not the case however. The standard requires that the Update procedure
 raise an Update_Error in this situation. Is this intended? (No.)
 
 Even when Update does not raise Update_Error, it does not work as expected.
@@ -89,148 +80,27 @@
 nul truncate the Item, and thus passing it a nul-terminated string is bound
 to cause trouble.
 
-The effect is that the Update with a Char_Array parameter and the Update with
-a String parameter operate quite differently. This cannot have been intended.
+The problem here is the equivalence adds a nul to the input string. If no
+nul is added, the behavior of the Update with a String parameter operates
+as expected.
+
+The rather bizarre shortening semantics of the Update with a Char_Array
+parameter is clearly intended, as it is noted in the AARM.
+
+The rather bizarre and error-prone shortening semantics of the Update with a
+Char_Array parameter is inconsistent with the rest of the standard, as the
+other subprograms in Interfaces.C.Strings that take a Char_Array allow an
+optionally nul-termination parameter as do the similar subprograms in
+Interfaces.C. However, since this semantics is clearly intended (as evidenced
+by the AARM note), there is insufficient reason to add a Truncate parameter.
 
-The fact that the Update with a Char_Array parameter containing nul (such as
-a nul-terminated string) is inconsistent with the rest of the standard.
-The other subprogram in Interfaces.C.Strings that takes a Char_Array allows
-an optionally nul-terminated parameter as do the subprogram in Interfaces.C.
-
-To modify the first example in the question:
-
-with Interfaces.C.Strings;
-use  Interfaces.C, Interfaces.C.Strings;
-
-procedure Cstr_Update_Test3 is
-
-   Cs : Chars_Ptr;
-
-   C1 : Char_Array := To_C("ABCD");
-   C2 : Char_Array := To_C("WXYZ");
-
-begin
-   Cs := New_Char_Array(C1);
-
-   Update(Cs, 0, C2);
-end Cstr_Update_Test3;
-
-Update also raises Update_Error in this case, even though the "real" parts
-of the strings are the same length.
-
-The original reason for this behavior is to provide optional truncation of the
-string item. This use is error-prone (as seen in the second example in the
-question).
-
-Therefore, we recommend that Update with a Char_Array parameter be redefined
-to support nul-terminated strings as input. In order to continue to support
-truncation, we recommand adding a Truncate parameter.
-
-!corrigendum  B.3.1(18)
-
-@drepl
-@xcode<@b<procedure> Update (Item   : @b<in> chars_ptr;
-                  Offset : @b<in> size_t;
-                  Chars  : @b<in> char_array;
-                  Check  : Boolean := True);>
-@dby
-@xcode<@b<procedure> Update (Item     : @b<in> chars_ptr;
-                  Offset   : @b<in> size_t;
-                  Chars    : @b<in> char_array;
-                  Check    : Boolean := True;
-                  Truncate : Boolean := False);>
-
-!corrigendum  B.3.1(19)
-
-@drepl
-@xcode<@b<procedure> Update (Item   : @b<in> chars_ptr;
-                  Offset : @b<in> size_t;
-                  Str    : @b<in> String;
-                  Check  : Boolean := True);>
-@dby
-@xcode<@b<procedure> Update (Item     : @b<in> chars_ptr;
-                  Offset   : @b<in> size_t;
-                  Str      : @b<in> String;
-                  Check    : Boolean := True;
-                  Truncate : Boolean := False);>
-
-!corrigendum  B.3.1(43)
-
-@drepl
-@xcode<@b<procedure> Update (Item   : @b<in> chars_ptr;
-                  Offset : @b<in> size_t;
-                  Chars  : @b<in> char_array;
-                  Check  : Boolean := True);>
-@dby
-@xcode<@b<procedure> Update (Item   : @b<in> chars_ptr;
-                  Offset : @b<in> size_t;
-                  Chars  : @b<in> char_array;
-                  Check  : Boolean := True;
-                  Truncate : Boolean := False);>
-
-!corrigendum  B.3.1(45)
-
-@drepl
-@xbullet<Let N = Strlen(Item). If Check is True, then:>
-@dby
-@xbullet<Let N=Strlen(Item). Let M=Chars'Length if Chars does not contain nul,
-or the smallest size_t value I such that Chars(I)=nul minus Chars'First.
-If Check is True, then:>
-
-!corrigendum  B.3.1(46)
-
-@drepl
-@xinbull<If Offset+Chars'Length>N, propagate Update_Error.>
-@dby
-@xinbull<If Offset+M>N, propagate Update_Error.>
-
-!corrigendum  B.3.1(46)
-
-@drepl
-@xinbull<If Offset+Chars'Length>N, propagate Update_Error.>
-@dby
-@xinbull<If Offset+M>N, propagate Update_Error.>
-
-!corrigendum  B.3.1(47)
-
-@drepl
-@xinbull<Otherwise, overwrite the data in the array pointed to by Item,
-starting at the char at position Offset, with the data in Chars.>
-@dby
-@xinbull<Otherwise, overwrite the data in the array pointed to by Item,
-starting at the char at position Offset, with the data in Chars. If Truncate
-is True, write a nul at position Offset+M (truncating Item after Chars).>
-
-!corrigendum  B.3.1(48)
-
-@drepl
-@xbullet<If Check is False, then processing is as above, but with no check
-that Offset+Chars'Length>N.>
-@dby
-@xbullet<If Check is False, then processing is as above, but with no check
-that Offset+M>N.>
-
-!corrigendum  B.3.1(49)
-
-@drepl
-@xcode<@b<procedure> Update (Item   : @b<in> chars_ptr;
-                  Offset : @b<in> size_t;
-                  Str    : @b<in> String;
-                  Check  : Boolean := True);>
-@dby
-@xcode<@b<procedure> Update (Item     : @b<in> chars_ptr;
-                  Offset   : @b<in> size_t;
-                  Str      : @b<in> String;
-                  Check    : Boolean := True;
-                  Truncate : Boolean := False);>
-
 !corrigendum  B.3.1(50)
 
 @drepl
 @indent<Equivalent to Update(Item, Offset, To_C(Str), Check).>
 @dby
-@indent<Equivalent to Update(Item, Offset, To_C(Str), Check, Truncate).>
-
+@indent<Equivalent to Update(Item, Offset, To_C(Str, Append_Nul => False),
+Check).>
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent