Skip to content

Adding or subtracting a number and itself #273

@cpovirk

Description

@cpovirk

Over a year ago, I ran a check over Google code for two patterns:

  • x - x
  • (x + x) / 2 (but probably even x + x is suspicious)

Results are in internal CL 49788955. I see some of the same kinds of things you see for x == x (e.g., foo1.getX() - foo1.getX() instead of foo1.getX() - foo2.getX()). I also see some people using bad date APIs that require January = 0, for which they write 1 - 1 for January, 12 - 1 for December, etc. There may be other patterns where we wouldn't want to do this. Maybe we can just throw out anything with literals?

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