数据类型问题

数据类型问题

问题描述:

我正在尝试将 C 程序移植到具有以下类型声明

I am trying to port a C program to a SPARC architecture that has the following type declaration

#include <stdint.h>

typedef uint32_t  WORD ;
typedef uint64_t DWORD ; 

问题是,编译器告诉我找不到 stdint.h.因此,我将这些数据类型重新定义如下:

The trouble is, that the compiler tells me that stdint.h cant be found. Hence, I redefined those datatypes as follows:

unsigned int  WORD; 
unsigned long DWORD;

这对我来说似乎是直接的声明,但程序并没有像它应该的那样期待.我可能错过了什么吗?

This seems for me the straightforward declaration, but the program is not expecting as it should. Did I maybe miss something?

谢谢

和类型 uint32_tuint64_t在 ISO/IEC 9899:1999 中是新的".您的编译器可能只符合标准的先前版本.

<stdint.h> and the types uint32_t and uint64_t are "new" in ISO/IEC 9899:1999. Your compiler may only conform to the previous version of the standard.

如果您确定 unsigned intunsigned long 分别是 32 位和 64 位,那么您不应该有任何问题(至少不是由于到 typedef 本身).就像您一样,情况可能并非如此.你知道(或者你能知道)你的编译器是否支持 unsigned long long?

If you are sure that unsigned int and unsigned long are 32-bit and 64-bit respectively then you shouldn't have any problems (at least not ones due to the typedefs themselves). As you are, this may not be the case. Do you know (or can you find out) if your compiler supports unsigned long long?

我猜 unsigned int 可能是 32 位的,你的 SPARC 有多大?

I'm guessing that unsigned int is probably 32-bit, how old is your SPARC?