ARMmbed / ARMmbed/mbed-drivers
Use the safe bool ideom instead of providing operator bool
- Dominant language
- C++
- Stars
- 39
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
We should use the [safe bool ideom](http://www.artima.com/cppsource/safebool.html) instead of defining operator bool, as operator bool allows an implicit conversion to int, which can cause unexpected behaviour.
[re-usable safe-bool implementation](http://www.artima.com/cppsource/safebool3.html)
Contributor guide
No contributing guide indexed for this repository
Research direction
Search the repository for definitions of operator bool and read the surrounding driver code to understand how those conversions are used. Compare the existing behavior with the linked safe-bool implementation; done means the relevant drivers use safe-bool behavior without allowing an implicit conversion to int, with existing tests still passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100