社区
C语言
帖子详情
unsigned int与UINT32有什么区别?
sweatytoothbuaa
2011-07-18 07:39:54
不太明白
...全文
10863
45
打赏
收藏
unsigned int与UINT32有什么区别?
不太明白
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
45 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
赵4老师
2012-01-12
打赏
举报
回复
C:\Program Files\Microsoft Visual Studio\VC98\Include\BASETSD.H
41: typedef unsigned int UINT32, *PUINT32;
WarriorKing
2012-01-12
打赏
举报
回复
[Quote=引用 1 楼 bdmh 的回复:]
一样
typedef unsigned int UINT32
[/Quote]不一样好吧,要看具体是怎么定义的,有些就不一定是你这样定义的
nice_cxf
2012-01-12
打赏
举报
回复
方便移植?gcc里面连UINT32都没有,方便的了才怪
如果微软日后升级了vs,把int升级为64位了,只是方便了这种移植,跨平台大概要用uint_32_t,不过vs似乎目前不支持
hello_kitty8888
2012-01-12
打赏
举报
回复
[Quote=引用 16 楼 z214957578 的回复:]
引用 15 楼 babilife 的回复:
引用 14 楼 luciferisnotsatan 的回复:
UINT32 确保是 无符号32位整形
unsigned int 不一样是32位的
+++1
+++++1
[/Quote]
+++++++++++++++1
ccjsj1
2012-01-12
打赏
举报
回复
[Quote=引用 10 楼 long0530 的回复:]
typedef unsigned int UINT32
UINT32 使用起来更方便,在32位系统上和 unsigned int 是一个意思
[/Quote]
UNIT32通过typedef unsigned int 了,为了跨平台兼容性好。
朱韦刚
2011-08-25
打赏
举报
回复
typedef struct A
{
int a;
}A_p
A_p a_p;
a_p.a = 2;
一样是为了方便!!
mymtom
2011-08-25
打赏
举报
回复
C99标准里有uint_32_t,在stdint.h或inttypes.h里。
CJacky++
2011-08-25
打赏
举报
回复
嗯,没错,是方便移值。
嵌入式项目里很少直接使用C语言内置数据类型名,因为C标准没有把内置数据类型的大小定死,不方便在不同的平台移植。
ddownload
2011-08-25
打赏
举报
回复
[Quote=引用 1 楼 bdmh 的回复:]
一样
typedef unsigned int UINT32
[/Quote]
您又来忽悠人?您这种鸟水平还申请版主?
daviddb7
2011-08-25
打赏
举报
回复
int在不同的环境下可能大小不一样,而UINT32指明了在任何环境下,都是32位的。
如果确定是32位环境,那这两个没有区别。
wyfwx
2011-08-25
打赏
举报
回复
unsigned int是预定好的,
UINT32是要另外定义的,你可以把它定义成任何东西
Chuckbass
2011-08-24
打赏
举报
回复
学习了
自由建客
2011-07-21
打赏
举报
回复
[Quote=引用 28 楼 0153 的回复:]
64位编译器中一般会采用以下定义:
typedef unsigned long UINT32;
或
typedef unsigned short UINT32;
[/Quote]
typedef unsigned int UINT32;
0153
2011-07-21
打赏
举报
回复
[Quote=引用 27 楼 ljd680 的回复:]
引用 14 楼 luciferisnotsatan 的回复:
UINT32 确保是 无符号32位整形
unsigned int 不一样是32位的
请问一下是如何确保的,如果一个是32位,一个是64位,那么UINT32在64位中如何保证是32为而不是64位呢?
谢谢!
[/Quote]
64位编译器中一般会采用以下定义:
typedef unsigned long UINT32;
或
typedef unsigned short UINT32;
炼气士
2011-07-21
打赏
举报
回复
[Quote=引用 14 楼 luciferisnotsatan 的回复:]
UINT32 确保是 无符号32位整形
unsigned int 不一样是32位的
[/Quote]
请问一下是如何确保的,如果一个是32位,一个是64位,那么UINT32在64位中如何保证是32为而不是64位呢?
谢谢!
紫色动力
2011-07-21
打赏
举报
回复
[Quote=引用 1 楼 bdmh 的回复:]
一样
typedef unsigned int UINT32
[/Quote]
学习了
ccnadogteam2
2011-07-21
打赏
举报
回复
学习了
picurl
2011-07-21
打赏
举报
回复
1. 確保 32 位
2. 在各機器及各版本 include 中都有對應的宣告
3. 以本人實際工作使用來說,我們透過一交換平台與其他公司交換資料,
因各家使用的機台平台不同,因此,例如 int 所佔的 byte 是不同的,
為交換資料的一致性,在數字規格定義上都用 UINT8, UINT16, UINT32 等等,
確保交換無誤
Dirk
2011-07-21
打赏
举报
回复
[Quote=引用 1 楼 bdmh 的回复:]
一样
typedef unsigned int UINT32
[/Quote]
书写简短,还有就是便于移植。
pathuang68
2011-07-21
打赏
举报
回复
[Quote=引用 2 楼 sweatytoothbuaa 的回复:]
引用 1 楼 bdmh 的回复:
一样
typedef unsigned int UINT32
那有了unsigned int,为啥又要有UINT32呢?
[/Quote]
方便嘛。UINT32才敲6下,unsigned int要敲次数多一些吧。最主要的还是为了保证数据类型名称上的一致性。
加载更多回复(24)
Java数值类型与byte数组相互转换
Java bytes数组与基本类型的相互转换
Int
-> Bytes
int
64ToByte8
int
48ToByte6
int
40ToByte5
int
32
ToByte4
int
24ToByte3
int
16ToByte2
int
8ToByte Bytes ->
Int
bytesTo
Int
64 bytesTo
Int
48 bytesTo
Int
40 bytesTo
Int
32
bytesTo
Int
24 bytesTo
Int
16 U
int
-> Bytes
unsigned
Int
64ToBytes
unsigned
Int
48ToBytes
unsigned
Int
40ToBytes
unsigned
Int
32
ToBytes
unsigned
Int
24ToBytes
unsigned
Int
16ToBytes
unsigned
Int
8ToBytes Bytes -> U
int
unsigned
Bytes2
Int
64
unsigned
Bytes2
Int
48
unsigned
Bytes2
Int
40
unsigned
Bytes2
Int
32
unsigned
Bytes2
Int
24
unsigned
Bytes2
Int
16
unsigned
Bytes2
Int
8 Float Double -- Bytes byte4ToFloat floatToByte4 byte8ToDouble doubleToByte8
TCP协议实验源代码
TCP协议实验代码,TCP.cpp extern void tcp_DiscardPkt(char *pBuffer,
int
type);//TCP丢弃段函数 extern void tcp_sendIpPkt(
unsigned
char *pData, U
INT
16 len,
unsigned
int
srcAddr,
unsigned
int
dstAddr, U
INT
8 ttl);//IP分组发送函数 extern
int
waitIpPacket(char *pBuffer,
int
timeout);//IP数据分组主动接收函数 extern
unsigned
int
getIpv4Address();//客户端获取本机Ipv4地址 extern
unsigned
int
getServerIpv4Address();//客户端获取服务器Ipv4地址
Bresenham直线算法的C++实现
在linux下面写的,WIN下面用的话把 typedef
int
32
_t
int
32
; typedef u
int
32
_t u
int
32
; 改成 typedef __
int
32
int
32
; typedef
unsigned
__
int
32
u
int
32
;
CRC校验源码BYTE CRC_8(BYTE *pDatabuf, U
INT
dataLen)
CRC校验源码
unsigned
int
CRC_
32
(const
unsigned
char *buf,
unsigned
int
size); BYTE CRC_8(BYTE *pDatabuf, U
INT
dataLen)
md5算法的c++实现
看到一个不错的c++实现的md5算法 class MD5 { public: typedef
unsigned
int
size_type; // must be
32
bit MD5(); MD5(const std::string& text); void update(const
unsigned
char *buf, size_type length); void update(const char *buf, size_type length); MD5& finalize(); std::string hexdigest() const; friend std::ostream& operator<<(std::ostream&, MD5 md5); private: void init(); typedef
unsigned
char u
int
1; // 8bit typedef
unsigned
int
u
int
4; //
32
bit enum {blocksize = 64}; // VC6 won't eat a const static
int
here void transform(const u
int
1 block[blocksize]); static void decode(u
int
4 output[], const u
int
1 input[], size_type len); static void encode(u
int
1 output[], const u
int
4 input[], size_type len); bool finalized; u
int
1 buffer[blocksize]; // bytes that didn't fit in last 64 byte chunk u
int
4 count[2]; // 64bit counter for number of bits (lo, hi) u
int
4 state[4]; // digest so far u
int
1 digest[16]; // the result // low level logic operations static inline u
int
4 F(u
int
4 x, u
int
4 y, u
int
4 z); static inline u
int
4 G(u
int
4 x, u
int
4 y, u
int
4 z); static inline u
int
4 H(u
int
4 x, u
int
4 y, u
int
4 z); static inline u
int
4 I(u
int
4 x, u
int
4 y, u
int
4 z); static inline u
int
4 rotate_left(u
int
4 x,
int
n); static inline void FF(u
int
4 &a, u
int
4 b, u
int
4 c, u
int
4 d, u
int
4 x, u
int
4 s, u
int
4 ac); static inline void GG(u
int
4 &a, u
int
4 b, u
int
4 c, u
int
4 d, u
int
4 x, u
int
4 s, u
int
4 ac); static inline void HH(u
int
4 &a, u
int
4 b, u
int
4 c, u
int
4 d, u
int
4 x, u
int
4 s, u
int
4 ac); static inline void II(u
int
4 &a, u
int
4 b, u
int
4 c, u
int
4 d, u
int
4 x, u
int
4 s, u
int
4 ac); }; std::string md5(const std::string &str);
C语言
70,020
社区成员
243,266
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章