|
|
|
|
|
by zamalek
2787 days ago
|
|
You can re-interpret the struct to a pointer (length would simply be truncated). Apart from that there wouldn't be any benefit: the pointer and length would be aligned no matter which position they take (on x86 and amd64 at the very least). |
|
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:
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.