This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 02/20/15 05:10, Jakub Jelinek wrote:
Right. If someone wants to take it up with the Austin group, that's fine. But until/unless the Austin group blesses, I don't think we should extend as a QoI matter.On Fri, Feb 20, 2015 at 12:06:28PM +0100, Florian Weimer wrote:On 02/19/2015 09:56 PM, Sandra Loosemore wrote:Hmmmm, Passing the additional option in user code would be one thing, but what about library code? E.g., using memcpy (either explicitly or implicitly for a structure copy)?The memcpy problem isn't restricted to embedded architectures. size_t size; const unsigned char *source; std::vector<char> vec; â vec.resize(size); memcpy(vec.data(), source, size); std::vector<T>::data() can return a null pointer if the vector is empty, which means that this code is invalid for empty inputs. I think the C standard is wrong here. We should extend it, as a QoI matter, and support null pointers for variable-length inputs and outputs if the size is 0. But I suspect this is still a minority view.I disagree. If you want a function that will have that different property, don't call it memcpy.
jeff
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |