Skip to content

add a compile error for bitwise operator when it is likely misunderstood to be the power operator #2699

@andrewrk

Description

@andrewrk

Inspired by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90885

If someone were to type this code:

const two_to_the_power_of_16 = 2^16; // incorrect!

Given that it is unlikely someone would actually want a number literal and then xor and a number literal, maybe this should be an error. This would probably be better expressed as 1 << 16 anyway.

  • Should we do this?
  • Should it be for only base 2? Base 10? ALL YOUR BASE?

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions