Skip to content

Document bool cast semantics #20

Closed

Description

@steveklabnik

Moved from rust-lang/rust#34729


After a short debate on the IRC over whether true as i32 is guaranteed to be 1, and false as i32 is guaranteed to be 0, I think that the semantics section on casts should explicitly describe what a bool as integer_type cast does.

Activity

  1. est31 commented on Mar 23, 2017

    @est31
    Member

    As I've said in rust-lang/rust#34729, it is defined indirectly in the reference, but not directly (yet).

  2. frewsxcv commented on Mar 25, 2017

    @frewsxcv
    Contributor

    Related to casting: #10

  3. matthewjasper commented on Jun 2, 2017

    @matthewjasper
    Contributor

    #13 closes this (unless the behavior is not in fact guaranteed to be true to 1, false to 0).

  4. chordowl commented on Aug 17, 2017

    @chordowl
  5. frewsxcv commented on Aug 17, 2017

    @frewsxcv
    Contributor

    Agreed, thanks for pointing it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions