[PATCH] D63049: Coding Standard: Prefer `int` for regular arithmetic

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 23:25:37 PDT 2019


mehdi_amini added inline comments.


================
Comment at: llvm/docs/CodingStandards.rst:1553
+subtraction would produce some huge number. This happens even when working
+with seemingly harmless numbers like A=2, B=2, and C=3.
+
----------------
jdoerfert wrote:
> 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?
Right, Justin mentioned that A=2, B=3, C=2 are better choices here!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63049/new/

https://reviews.llvm.org/D63049





More information about the llvm-commits mailing list