为什么每个人都对标准C类型进行定义? [英] Why does everybody typedef over standard C types?
问题描述
如果您想使用 Qt ,则必须使用 quint8
, quint16
等。
If you want to use Qt, you have to embrace quint8
, quint16
and so forth.
如果要使用 GLib ,您必须欢迎 guint8
, guint16
等等。
在 Linux 有 u32
, s16
等。
uC / OS 定义 SINT32
, UINT16
等。
如果您必须结合使用这些东西,则最好为遇到麻烦做好准备。因为在您的计算机上, u32
将是 typedef
d超过 long
和 quint32
将是 typedef
d int
和编译器会抱怨。
And if you have to use some combination of those things, you better be prepared for trouble. Because on your machine u32
will be typedef
d over long
and quint32
will be typedef
d over int
and the compiler will complain.
如果存在< stdint.h> $ c,为什么每个人都会这样做$ c>?
推荐答案
stdint.h
在开发这些库时还不存在。因此,每个库都有自己的 typedef
s。
stdint.h
didn't exist back when these libraries were being developed. So each library made its own typedef
s.
这篇关于为什么每个人都对标准C类型进行定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!