This issue has been automatically converted from the original issue lists and some formatting may not have been preserved.
Authors: WG 14, Blaine Garst
Date: 2013-07-31
Reference document: N1736
Submitted against: C11 / C17
Status: Closed
Converted from: n2396.htm
It has been noted that the descriptions for 7.24.2.1 memcpy, 7.24.2.2
memmove and 7.24.4.1 memcmp are written using the term character which is
inconsistent with their design as memory functions. Moreover, if one then
reads 3.7.2 as allowing character to mean multibyte character, it is thought
that confusion could arise as to whether the number of multibyte characters
should be supplied rather than the number of bytes.
Although it is clear by 7.24.1 String function conventions paragraph 3
For all functions in this sub clause, each character shall be interpreted as if it had the type
unsigned char
that the number of bytes to be used corresponds to the size of a unsigned char, one has to reference 6.2.6 Representation of types to learn that
unsigned char is in fact a single byte (consisting of CHAR_BIT bits).
It would be simpler and more to the point if the three memory functions describe
their count parameter n in terms of bytes.
memcpy
Change 7.24.2.1 p 2 first sentence from
The
memcpyfunction copiesncharacters from the object pointed to bys2into the object pointed to bys1.
to
The
memcpyfunction copiesnbytes from the object pointed to bys2into the object pointed to bys1.
memmove
Change 7.24.2.2 p 2 from
The
memmovefunction copiesncharacters from the object pointed to bys2into the object pointed to bys1. Copying takes place as if thencharacters from the object pointed to bys2are first copied into a temporary array ofncharacters that does not overlap the objects pointed to bys1ands2, and then thencharacters from the temporary array are copied into the object pointed to bys1.
to
The
memmovefunction copiesnbytes from the object pointed to bys2into the object pointed to bys1. Copying takes place as if thenbytes from the object pointed to bys2are first copied into a temporary array ofnbytes that does not overlap the objects pointed to bys1ands2, and then thenbytes from the temporary array are copied into the object pointed to bys1.
memcmp
Change 7.24.4.1 p 2 from
The
memcmpfunction compares the firstncharacters of the object pointed to bys1to the firstncharacters of the object pointed to bys2.
to
The
memcmpfunction compares the firstnbytes of the object pointed to bys1to the firstnbytes of the object pointed to bys2.
Comment from WG14 on 2014-10-31:
Oct 2013 meeting
After reviewing the original motivation and suggestion for change, it was noted by the project editor that "character" is used in several distinct contexts, and that it would be inappropriate to simply improve one area without a comprehensive review of all uses such that the existing consistency of uses of character be replaced in a consistent new manner, as yet undetermined. As it stands, although careful reading is strictly required, it is correct and as such this is not a defect.