This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Initializing structs with memset

Why is it a standard in nordic-supplied code to initialize structs with memset like so? An example would be:

ble_gatts_char_md_t char_md;
memset(&char_md, 0, sizeof(char_md));

Instead of a cleaner way:

ble_gatts_char_md_t char_md = {0};

I understand that using memset also clears padding bits, but don't understand the reason for doing so.

Related