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

Sign up
Appearance settings

Error accessing bool #6057

Closed
Closed
Labels
Library: EEPROMThe EEPROM Arduino library Waiting for feedbackMore information must be provided before we can proceed
@plgarcia

Description

When setting bool to true or false, only the lower bit is set to 1 or 0.

But a test compares the full byte.

When for some reason, for example restoring à bool from EEPROM, some of the higher bits of the octet are set to 1, if (mybool) is always true even if the mybool is set to false jut before the test..
There is no way to set this bool to false.

For static variable this happens or not from one version to another, depending probably on what is present in memory at startup.

To solve that, in my software I declared some defines (BOOL uint8_t, TRUE 1, FALSE 0) and do not manipulate bool any longer.
I program on Arduino MEGA 2560

Metadata

Metadata

Assignees

No one assigned

    Labels

    Library: EEPROMThe EEPROM Arduino library Waiting for feedbackMore information must be provided before we can proceed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /