3 ms·
The first pointer-sized chunk of the string structure is a pointer to the C-string representation. So the cast works as written.
by twoodfin 2y ago
The first pointer-sized chunk of the string structure is a pointer to the C-string representation. So the cast works as written.
- fluoridation 2y agoWell, no, because (const char *)str is nonsense, if str is an std::string.
- twoodfin 2y agoNot to the debugger. If the first 8 bytes of the object referenced by str is a char* the debugger is perfectly capable of using it that way.