4 ms·
That depends on what p points to. If it’s the address of the char[1] array inside a valid PMyStr, then as far as I’m aware you can subtract the correct number o
by saagarjha 7y ago
That depends on what p points to. If it’s the address of the char[1] array inside a valid PMyStr, then as far as I’m aware you can subtract the correct number of bytes (offsetof is your friend) and cast the resulting pointer to your MyStr, then get the size from there.
- projektfu 7y agoAh, with your information I'm looking into the container_of macro which I'm not entirely certain is legitimate but hasn't run into problems.