Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Get rid of boolean type; use bool instead #4673

Copy link
Copy link
Open
@cousteaulecommandant

Description

@cousteaulecommandant
Issue body actions

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 and char

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 with bool.
  • Update the documentation, removing all references to boolean and replacing them with bool (and maybe adding a note that the boolean type is deprecated).
  • State that the boolean type is deprecated. An __attribute__ ((deprecated ("use bool instead"))) on the boolean definition could be a good idea.
  • Eventually, a few versions after deprecating boolean, consider its removal. (Or leave it there forever, just in case.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestA request to make an enhancement (not a bug fix)A request to make an enhancement (not a bug fix)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.