Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What is the difference between type conversion and type promotion in c++?
What is the difference between type conversion and type promotion in c++?
what is stored in p>Memory is the complement, which is the form after being converted into binary

according to the value of the stored specific data. If it exceeds the range of this data type, I don't know what the storage form is. This

should be the compiler-related way to deal with the cross-border number; (No matter what

unitary system is used when saving, pay attention to the function of+/-monocular operator here)

No matter what operation you want to do, you must first look at what this number looks like when saving it in memory;

Type promotion/truncation are all operations on data in memory, and it is necessary to

expand the bit when promoting: when expanding the unsigned number, just directly add zeros to the expanded bit (because unsigned is positive); Sign extension is performed if the signed number

is extended. If it is an integer, that is, the original most significant bit

is zero, it will be filled with zero, and if it is negative, that is, the original most significant bit is 1, it will be fully filled with 1. When truncating data, it is

to start counting digits from the low order and then truncating them. Note here that we usually use Little Endian

type coercion, which is actually just a way to present the data stored in memory. For example, when the memory

is 8 (that is, 1 ), if unsigned short int is used, the

is printed to the 15th power of 2. If short int is used, it will be printed to the 16th power of minus 2. < P > If the operand data types are inconsistent during arithmetic operation and binocular bit operation, firstly, the Arithmetical Conversion type of data in line < P > will be upgraded (in fact, upgrading means bit expansion, Then the expanded memory binary code is forcibly converted into a certain data type and printed), and then the operation is started.

When performing monocular operation, the Integer Promotion is first performed, and then the integer promotion operation is started.