This is an archive of the discontinued LLVM Phabricator instance.

Coding Standard: Prefer `int` for regular arithmetic
Needs ReviewPublic

Authored by mehdi_amini on Jun 8 2019, 10:16 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This is a proposal to standardize a preference to use signed integer when possible. See inline diff for more info.

http://lists.llvm.org/pipermail/llvm-dev/2019-June/132890.html

Diff Detail

Event Timeline

mehdi_amini created this revision.Jun 8 2019, 10:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2019, 10:16 AM
mehdi_amini edited the summary of this revision. (Show Details)Jun 8 2019, 10:18 AM
jdoerfert added inline comments.
llvm/docs/CodingStandards.rst
1553

I think I lost my elementary school algebra over the years. What I get is:

A + B > C        | - B

A     > C - B

And with A = 2, B = 2, C = 3:

2 + 2 > 3       <=> 4 > 3
2     > 3 - 2   <=> 2 > 1

What am I missing here?

mehdi_amini marked 2 inline comments as done.
mehdi_amini added inline comments.
llvm/docs/CodingStandards.rst
1553

Right, Justin mentioned that A=2, B=3, C=2 are better choices here!

jdoerfert added inline comments.Jun 25 2019, 8:52 AM
llvm/docs/CodingStandards.rst
1553

Also, fix the inequality ;)