This question and many more are among the numerous questions on this site that ask if a call to memcpy()
is valid with a length\size specified with a zero value.
When answering, everyone quotes the current C standard (in this case C17 ISO/IEC9899:2017 page 283 ),
Where an argument declared as
size_t
n
specifies the length of the array for a function,n
can have the value zero on a call to that function. Unless explicitly stated otherwise in the description of a particular function in this subclause, pointer arguments on such a call shall still have valid values, as described in 7.1.4. On such a call, a function that locates a character finds no occurrence, a function that compares two character sequences returns zero, and a function that copies characters copies zero characters.
However, this is from C standard, not quoted from the C++ standard.
Where in the current C++ standard (i.e. C++17 ISO/IEC 14882) is this same definition listed? C and C++ have two different standards (and languages) and from my understanding, you cannot quote one and expect that same rule/behavior to be present in the other standard.
If this quotation from the C standard is valid in C++ without explicitly stating it in the standard, can someone then provide a source that backs up this connection between C and C++?