实习中,今天在看公司源码的时候,发现前辈给的代码都是这样的

typedef int8_t int8;
typedef uint8_t uint8;
typedef int16_t int16;
typedef uint16_t uint16;
typedef word_t word16;
typedef int32_t int32;
typedef uint32_t uint32;
typedef dword_t dword32;
typedef int64_t int64;
typedef uint64_t uint64;
typedef uint32 color_t; typedef time_t time64;
typedef wchar_t char16;//宽字符
typedef char char8;

 身为小白的我内心是这样的      ???????

查找后得出了结论,其实这些都是已经被typedef过的类型:

typedef signed char int8_t;
typedef unsigned char uint8_t; typedef int int16_t;
typedef unsigned int uint16_t; typedef long int32_t;
typedef unsigned long uint32_t; typedef long long int64_t;
typedef unsigned long long uint64_t;

  这些包含在inttypes.h头文件,据说这样做的原因是方便移植,比如int8就是8位大小占一字节,int32,,32位大小4字节… 
这样相对应的占位符也就清楚了:

char /unsigned char: %c
int : %d
unsigned int: %u
long: %ld;
unsigned long:%lu
long long: %lld(%l64d)
unsigned long long:%Ilu(%l64u)

 即:

int8_t:%c;
uint8_t:%c; int16_t: %d;
uint16_t:%u; int32_t:%ld;
uint32_t:%lu; int64_t:%lld(%l64d);
uint64_t:%llu(%l64u);

资料:https://blog.csdn.net/eusia/article/details/76401235

关于int8_t,uint8_t.....等数据类型的理解的更多相关文章

  1. stdint.h 文件 int8_t uint8_t int16_t uint16_t

    http://blog.chinaunix.net/uid-26588712-id-3068151.html c++ 数据类型 按照posix标准,一般整型对应的*_t类型为:1字节     uint ...

  2. 与平台无关的类型,int8_t,uint8_t

    pecific integral type limits Specifier Common Equivalent Signing Bits Bytes Minimum Value Maximum Va ...

  3. 一些平台无关的整型类型,int8_t,uint8_t....

    pecific integral type limits Specifier Common Equivalent Signing Bits Bytes Minimum Value Maximum Va ...

  4. JS数据类型的理解(猜测)

    Js 数据类型 对于这个主题,首先来看几个问题,如果你对这几个问题很清楚的话,那就请直接跳过吧,不用接着往下看了,如果不清楚,建议你还是看看. 1)如果判断函数?function 和object的联系 ...

  5. C语言数据类型的理解

    数据类型的定义: 作为一种语言,必然有所谓的语言组成要素,就像日常生活中人们之间的交流一样,首先会有字,字再成词组,再来就是句子,后来呢就是段落等等.当然不同的字,词,句这些在一起,就会有不同的表达效 ...

  6. 我对js数据类型的理解和深浅(copy)的应用场景

    本人毕业一所专科院校,所学专业是计算机应用技术,在大学时对前端有了一定的了解之后,觉得自己对前端的兴趣十分强烈,开始自学前端,一路上也是坎坎坷坷,也有想要放弃的时候,还好坚持了下来,并且从事前端开发已 ...

  7. javascript: 数据类型深入理解

    1.基本类型(值类型或者原始类型): Number.Boolean.String.NULL.Undefined以及ES6的Symbol2.引用类型:Object.Array.Function.Date ...

  8. Python3 中bytes数据类型深入理解(ASCII码对照表)

    bytes的来源 bytes 是 Python 3.x 新增的类型,在 Python 2.x 中是不存在的. bytes 的意思是"字节",以字节为单位存储数据.而一个字节二进制为 ...

  9. C语言的数据类型的本质和提高学习

    一.数据类型的概念 类型是对数据的抽象 类型是相同的数据有相同的表示形式.存储格式以及相关的操作 程序中使用的数据必定属于某一种数据类型 ​ 1.算术类型: 包括三种类型:整数类型.浮点类型,枚举型. ...

随机推荐

  1. 论文笔记:Diffusion-Convolutional Neural Networks (传播-卷积神经网络)

    Diffusion-Convolutional Neural Networks (传播-卷积神经网络)2018-04-09 21:59:02 1. Abstract: 我们提出传播-卷积神经网络(DC ...

  2. NLP related basic knowledge with deep learning methods

    NLP related basic knowledge with deep learning methods  2017-06-22   First things first >>> ...

  3. DownAlbum:Chrome的pinterest批量下载插件

    一.DownAlbum安装 二.DownAlbum使用 点击DownAlbum图标. 选择Normal. 会出现一个加载的弹窗,等待片刻会打开一个新的窗口. 按Ctrl+S,即可保存相册所有图片. 图 ...

  4. SpringMVC统一转换null值为空字符串的方法 !

    在SpringMVC中,可以通过在<mvc:annotation-driven>中配置<mvc:message-converters>,把null值统一转换为空字符串,解决这个 ...

  5. angularjs启动项目报ERROR in AppModule is not an NgModule解决方法

    这主要是ts编译器版本问题,一般是因为ts编译器版本过高导致. 解决方式: npm uninstall -g typescript npm install -g typescript tsc -v 查 ...

  6. Python 增强类库

    程序中断 # coding=utf-8 支持中文 re = iter(range(5)) try: for i in range(100): print re.next() except StopIt ...

  7. Hibernate的查询功能

    1.Query对象 1.使用Query对象,不需要写sql语句,但是写hql语句 (1)hql:hibernate query language,提供查询语言,这个hql语言和普通sql语句相似 (2 ...

  8. PHP 的命令行模式

    php CLI SAPI 内置Web Server 从版本 4.3.0 开始,PHP 提供了一种新类型的 CLI SAPI(Server Application Programming Interfa ...

  9. [转]fatal error LNK1112: 模块计算机类型“X86”与目标计算机类型“x64”冲突

    来自--------------------- 原文:https://blog.csdn.net/qtbmp/article/details/7273191?utm_source=copy win7 ...

  10. tslint无法工作:Failed to load the TSLint library for the document

    1--- 2--- 3---