3 ms·
"re-interpret the struct to a pointer (length would simply be truncated)." Wrong. It will be pointer-to-pointer. Reinterpretation (to treat struct as a pointe
by c-smile 8y ago
"re-interpret the struct to a pointer (length would simply be truncated)."
Wrong. It will be pointer-to-pointer.
Reinterpretation (to treat struct as a pointer to C string) is only possible if you have something like this:
struct BSTR {
size_t length;
WCHAR chars[N]; // N is length + 1
};
and you return pointer to chars[0]. This is so called Basic string - BSTR is a WCHAR* pointer to memory location prepended by string length field.
- zamalek 8y agoThat's not what I was going after. You can treat the memory location (where the structure resides) as a pointer, plan and simple, nothing more fancy than what I said.