1.unsigned Long is equivalent to unsigned int and can be abbreviated to unsigned.
2.llp64 the length of each type of compilation model:
Environment: Win-64/vs 2013
Code:
1Std::cout <<"size of (int):"<<sizeof(int ) 2<<"Byte."<<Std::endl;3Std::cout <<"size of (long):"<<sizeof(Long )4<<"Byte."<<Std::endl;5Std::cout <<"size of (long):"<<sizeof(Long Long )6<<"Byte."<<Std::endl;7Std::cout <<"size of (unsigned int):"<<sizeof(unsignedint ) 8<<"Byte."<<Std::endl;9Std::cout <<"size of (unsigned long):"<<sizeof(unsignedLong)Ten<<"Byte."<<Std::endl; OneStd::cout <<"size of (unsigned long long):"<<sizeof(unsignedLong Long) A<<"Byte."<< Std::endl;
Results:
4. Select the type of experience:
A. The unsigned type is chosen when it is clear that the value cannot be negative;
B. The actual application of int and long is the same size;
The default type of C.char may be unsigned or signed type, depending on the machine, so it should be clearly specified to be unsigned char or unsigned char;
D. Perform floating-point arithmetic using double. Because the float is usually not accurate and the double-precision floating-point number and the single-precision floating-point number calculation cost is similar;
E.long double provides the precision in general is not necessary, moreover it brings the computation time consumption also cannot neglect;
CPP variables and basic types (1)