0

unsigned/signed long int a; 可能为什么unsigned/signed long float/double a; 不可能 ?

为什么我在后者的声明错误中得到太多类型而不是前者?

4

3 回答 3

1

共有三种浮点类型floatdoublelong double。这些都没有未签名的等价物,因此将signedorunsigned放在它们前面是无效的。没有这样的类型long float

于 2015-06-28T09:34:45.873 回答
1

您收到该消息是因为存在 long double,但 unsigned long double 不存在。unsigned 也可以被解释为一个 int,因此你在后一个声明中拥有两种类型:unsignedlong double。我不相信 C++ 中有很长的浮点数。

于 2015-06-28T09:35:11.867 回答
0

这是因为第一个 ( long int) 是记录的变量类型,而第二个不是。

C++语言支持的数据类型有:

char         
unsigned char   
signed char     
int            
unsigned int    
signed int  
short int 
unsigned short int 
signed short int
long int    
signed long int 
unsigned long int 
float   
double  
long double     
于 2015-06-28T09:36:12.470 回答