Open
Description
Is there a need for the boolean
type at all, other than backwards compatibility?
Currently, Arduino's boolean
type is defined as an alias to bool
(thanks, Chris--A!). However I don't see the need to have a custom boolean
type when C and C++ already provide one.
Advantages of the bool
type are:
- it is shorter
- it is standard
- it is consistent with other "abbreviated" C and C++ types such as
int
andchar
I think it would be a good idea to stop using this custom boolean
type and instead use the bool
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
boolean
from Arduino core and library functions withbool
. - Update the documentation, removing all references to
boolean
and replacing them withbool
(and maybe adding a note that theboolean
type is deprecated). - State that the
boolean
type is deprecated. An__attribute__ ((deprecated ("use bool instead")))
on theboolean
definition could be a good idea. - Eventually, a few versions after deprecating
boolean
, consider its removal. (Or leave it there forever, just in case.)
Activity