4 ms·
Author didn't say "treat null pointer as an empty string". To treat a C string as empty, I have to dereference the pointer and see that the first byte is \0. I
by none_to_remain 4y ago
Author didn't say "treat null pointer as an empty string".
To treat a C string as empty, I have to dereference the pointer and see that the first byte is \0. If the pointer is 0x0 then I crash.
But if I want to copy 0 bytes to or from 0x0, I do not have to dereference 0x0.
I would want to spend way too long with the standard before I opined on the correctness of the author's statement, but "zero-sized object" is definitely different from "zero-length string".