4 ms·
memcpy behavior is not part of C++ standard. The C++ standard is only concerned with formally defining the ability to use it and the header name to include.
by halayli 10y ago
memcpy behavior is not part of C++ standard. The C++ standard is only concerned with formally defining the ability to use it and the header name to include.
- vardump 10y agoStrictly interpreting true, but grandparent's point is very valid. It's used everywhere in real life C++ code. quotemstr got a very good point and I'm grateful for the heads up.
- halayli 10y agobut memcpy outside the C++ scope is what I meant. The C++ committee cannot do much about memcpy but they can introduce a new memcpy with a different name that has better ub support.
- Kristine1975 10y agoThe C++ committee can and does change how functions of the C standard library work in C++, see Appendix C of the C++ Standard (granted, most of those changes simply specify how the library functions interact with C++ features). C++ is not 100% compatible with C.
- smitherfield 10y agoBut the C++ standard could, without any changes to C, be amended to formally define which assumptions the compiler may or may not make about the C API in certain edge cases, such as memcpy(0,0,0).
- halayli 10y agomemcpy is outside the territory of C++. it doesn't fall under the language specification. it's as simple as that. If they go this route what stops them from defining assumptions to system calls?