ARMmbed / mbed-os-example-ble

BLE demos using mbed OS and mbed cli
Apache License 2.0
134 stars 118 forks source link

why some example don't have destruct function? #224

Closed bestony closed 5 years ago

bestony commented 5 years ago

The Example BLE_BatteyLevel didn't have the destruct function.

https://github.com/ARMmbed/mbed-os-example-ble/blob/5f4cead86f34900a99096070b0f5a07ea8a9e11e/BLE_BatteryLevel/source/main.cpp#L31-L50

same as BLE_Beacon,BLE_Button.

The BLE_GAP has destruct function.

https://github.com/ARMmbed/mbed-os-example-ble/blob/5f4cead86f34900a99096070b0f5a07ea8a9e11e/BLE_GAP/source/main.cpp#L99-L120

pan- commented 5 years ago

@bestony I believe it is an harmless mistake. If you look at both examples, destructor is never called as we never exit the main. @paul-szczepanek-arm Any opinion about this issue ?

ciarmcom commented 5 years ago

Internal Jira reference: https://jira.arm.com/browse/MBOCUSTRIA-1039

bestony commented 5 years ago

yes, it harmless. but i think this is a exmaple for people who learn Mbed OS.

The cpp is diffcult to control Pointer , Keep Strict maybe is better for people who write code in embedded device

linlingao commented 5 years ago

@bestony It appears your question has been answered. Please reopen if you have further questions.

bestony commented 5 years ago

@linlingao Close is OK , but i think no destruct function will make more and more developer write some bad smell code.