Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Open
Description
Is there a need for theboolean type at all, other than backwards compatibility?
Currently, Arduino'sboolean type is defined as an alias tobool (thanks, Chris--A!). However I don't see the need to have a customboolean type when C and C++ already provide one.
Advantages of thebool type are:
- it is shorter
- it is standard
- it is consistent with other "abbreviated" C and C++ types such as
intandchar
I think it would be a good idea to stop using this customboolean type and instead use thebool one; in my opinion, the fewer unneeded additions Arduino makes to the language, the better.
The steps for moving would be (in this order):
- Replace all
booleanfrom Arduino core and library functions withbool. - Update the documentation, removing all references to
booleanand replacing them withbool(and maybe adding a note that thebooleantype is deprecated). - State that the
booleantype is deprecated. An__attribute__ ((deprecated ("use bool instead")))on thebooleandefinition could be a good idea. - Eventually, a few versions after deprecating
boolean, consider its removal. (Or leave it there forever, just in case.)