Which type to use in Cpp

发布时间:2014-10-23 23:25:18

  use an unsigned type when you know that the values cannot be negative.use int for integer arithmetic.use long long when the data values are larger than the minimum guaranteed size of an int.Do not use char or bool in arithmetic expressions.Use double for floating-point computations.   Reference: S.B. Lippman, "C++ Primer (5th version)", PUBLISHING HOUSE OF ELECTRONICS INDUSTRY, Beijing, 2013