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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 08:52:49 PDT 2019


jdoerfert 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.
+
----------------
mehdi_amini wrote:
> 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!
Also, fix the inequality ;)


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

https://reviews.llvm.org/D63049





More information about the llvm-commits mailing list