|
|
|
|
|
by LinAGKar
1600 days ago
|
|
But the code isn't equivalent. The C code just has a pointer to a manually allocated buffer, while the Rust does the equivalent of zeroing out (or leaving uninitialized) a C++ std::string. Akin to: auto name = reinterpret_cast<std::string >(malloc(sizeof(std::string)));
memset(name, 0, sizeof(std::string);
*name = "basic"; But on the stack. |
|