3 ms·
If you use: sizeof(struct_instance) the compiler will automatically update the size passed to memcpy. (I like passing the instance to sizeof and not the ty
by hedora 8y ago
If you use:
sizeof(struct_instance)
the compiler will automatically update the size passed to memcpy. (I like passing the instance to sizeof and not the type, just in case the type of the thing being copied changes in a future version of the code.)
- iforgotpassword 8y agoThat is exactly what I said: > ...if you don't recompile your module with the updated definition of the struct... And once you recompiled, the C99 version with the pretty initializer is fixed as well, so there is no advantage in using memset regarding this.