This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Structure initialization

Hi, I'm just wondering if there's a reason that the example code is always initializing all structures through functions. Has it something to do with sleep mode and RAM retention?

Why are you not initializing the structures when defining the static members like:

static ble_gap_sec_params_t m_sec_params = { 
	.timeout 	= 30,
	.bond 		= 1,
	.mitm 		= 0,
	.io_caps 	= BLE_GAP_IO_CAPS_NONE,
	.oob 		= 0,
	.min_key_size 	= 7,
	.max_key_size 	= 16,
}; 

Well, it's been like 10 years since I've last coded C and C++, and beeing used to higher level languages, it seems sligthly unnecessary to make both the defines and initializer functions to initalize a structure. Well, it's no big deal, but if there's no point of having the extra "overhead", I think I'll remove it from my own projects in the future.

Parents Reply Children
No Data
Related