libhal / SJSU-Dev2

Firmware platform written by San Jose State University for building application for embedded systems
Apache License 2.0
36 stars 63 forks source link

Add warning if bit::Register() has not used save() #1413

Open kammce opened 3 years ago

kammce commented 3 years ago

Feature Request

A common error that programmers can make when using bit::Register() is forgetting to execute the .Save() function at the end. There are two ways to solve this. Have the destructor of the object save contents or simply warn the developer that the contents have not been saved to anything. The second gives some flexibility and is less opaque to the developer. Potentially the first option of save on destruction can be performed with a bit::AutoSaveRegister, but that can be made another time.

Detailed Description

Can utilize the [[nodiscard("The register's contents have not yet been saved")]]