3 ms·
He's assuming that dest is zero-initialized, which I believe it will be as written. However, he should mention that because there will be plenty of similar cas
by nebulous1 8y ago
He's assuming that dest is zero-initialized, which I believe it will be as written. However, he should mention that because there will be plenty of similar cases where dest will not be initialized.
edit: As asveikau notes below, this is not the case
- asveikau 8y ago> He's assuming that dest is zero-initialized, which I believe it will be as written. Given this snippet, incorrect. Stack allocated buffers aren't zeroed out as in the above declaration.
- nebulous1 8y agoWell, then that's pretty bad!
- docker_up 8y agoNo, only global variables are zero-initialized. Neither stack variables nor malloced memory will be zero-initialized. OP should have memset to 0 or calloced the memory.