N
Nephi Immortal
If C++ Compiler for 32 bits and 64 bits are same, why do integer
numbers are set to 32 bits in C++ Compiler for 64 bits?
The documentation from MSDN says that the int type is always 32 bits
on 32 bit machine and 64 bit machine.
What happen when you place integer number in the function parameter?
The C++ Compiler always treats any integer number to int type instead
of long in 32 bits or long long in 64 bits.
I will hate to place (long long) before integer number in function
parameter manually.
void Xx( char x ) {}
void Xx( short x ) {}
void Xx( long x ) {}
void Xx( long long x ) {}
void Xx( int x ) {}
void Xx( unsigned char x ) {}
void Xx( unsigned short x ) {}
void Xx( unsigned long x ) {}
void Xx( unsigned long long x ) {}
void Xx( unsigned int x ) {}
int main()
{
Xx( 2 ); // Invoke Xx( int x )
Xx( 2L ); // Invoke Xx( long x )
Xx( 2U ); // Invoke Xx( unsigned int x )
Xx( 2UL ); // Invoke Xx( unsigned long x )
Xx( (long long) 2 ); // Invoke Xx( long long x )
return 0;
}
numbers are set to 32 bits in C++ Compiler for 64 bits?
The documentation from MSDN says that the int type is always 32 bits
on 32 bit machine and 64 bit machine.
What happen when you place integer number in the function parameter?
The C++ Compiler always treats any integer number to int type instead
of long in 32 bits or long long in 64 bits.
I will hate to place (long long) before integer number in function
parameter manually.
void Xx( char x ) {}
void Xx( short x ) {}
void Xx( long x ) {}
void Xx( long long x ) {}
void Xx( int x ) {}
void Xx( unsigned char x ) {}
void Xx( unsigned short x ) {}
void Xx( unsigned long x ) {}
void Xx( unsigned long long x ) {}
void Xx( unsigned int x ) {}
int main()
{
Xx( 2 ); // Invoke Xx( int x )
Xx( 2L ); // Invoke Xx( long x )
Xx( 2U ); // Invoke Xx( unsigned int x )
Xx( 2UL ); // Invoke Xx( unsigned long x )
Xx( (long long) 2 ); // Invoke Xx( long long x )
return 0;
}