今天看到这样的代码

typedef struct _Abc {
uint64_t unit_id;
......
} Abc;

开始不理解这个的意思,后来看到这个解释:

https://stackoverflow.com/questions/5558994/naming-convention-when-using-struct-in-c

There is no benefit in user code, it's just ugly. In the second example, the HuffCode_ isn't even necessary since the struct type is already named by the typedef.

The only places where this can be useful are:

1. When StructName is already in use, StructName_ gives a different name (but you should really come up with a better name).
2. Identifiers in the C standard library that are not defined by the standard shouldn't conflict with user code identifiers. Therefore, C library writers use the _ prefix in the hopes that users will not use that. Unfortunately, some users do.
3. In very old compilers, it may be useful to give the struct a different name than is used in the typedef. You need both the typedef and the other name if you're building a linked structure (example).

C/C++里面的struct和typedef的更多相关文章

  1. [转载]彻底弄清struct和typedef struct

    struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int ...

  2. struct和typedef struct彻底明白了

    struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int ...

  3. struct和typedef struct

    转自:http://www.cnblogs.com/qyaizs/articles/2039101.html struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++ ...

  4. 学习hash_map从而了解如何写stl里面的hash函数和equal或者compare函数

    ---恢复内容开始--- 看到同事用unordered_map了所以找个帖子学习学习 http://blog.sina.com.cn/s/blog_4c98b9600100audq.html (一)为 ...

  5. 细说 struct和typedef struct

    细说 struct和typedef struct 参考原文:http://www.cnblogs.com/qyaizs/articles/2039101.html,有些小改动~ 1 首先://注意在C ...

  6. C++/C中的struct和typedef struct用法和区别

    struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int ...

  7. 方阵里面的dp

    打了一场luogu的信心赛,惊讶地发现我不会T2,感觉像这样在矩阵里面的dp看起来很套路的样子,但是仔细想想还是有很多需要注意的细节. 又想到之前貌似也考过一些类似的题目 然而我并没有改 ,于是打算补 ...

  8. Unity3D研究之Prefab里面的Prefab关联问题

    Unity研究院之Prefab和GameObject的正向和逆向查找引用 我发现很多美工兄弟都爱问程序Unity3d为什么总丢材质? 我不排除U3d有BUG的情况下会丢材质?但是其实很多时候是人为操作 ...

  9. 关于c语言struct和typedef

    C++中使用: struct test{    int x, y;};就可以定义一个名为 test的结构体,但C中很可能编译通不过.C语言并不支持在struct后使用标示符定义结构体的名字,test将 ...

随机推荐

  1. shell-3.bash的基本功能:通配符和其他特殊字符

    1. 2.

  2. ActiveMQ学习笔记(4)----JMS的API结构和开发步骤

    1. JMS的API结构 其实上图中的五个API在第一节中我们都已经使用到了.本节将会讲非持久化和持久化topic的使用. 2. JMS的基本开发步骤 1. 创建一个JMS工厂,  Connectio ...

  3. Angualr+asp.net core webapi+efcore系列

    想着学习一门前端框架,WTF,看了又看,卧槽对于.Net程序员来说,还有什么比面向对象更香的呢,所以果断的选择了Angular.正好看各路大神以及官方文档想学习一下asp.net core,那就搞起吧 ...

  4. Linux重新命名文件夹

    linux 重命名文件和文件夹   linux下重命名文件或文件夹的命令mv既可以重命名,又可以移动文件或文件夹. 例子:将目录A重命名为B mv A B 例子:将/a目录移动到/b下,并重命名为c ...

  5. 关于wdsl

    WSDL元素 WSDL元素基于XML语法描述了与服务进行交互的基本元素: Type(消息类型):数据类型定义的容器,它使用某种类型系统(如XSD). Message(消息):通信数据的抽象类型化定义, ...

  6. oracle根据成绩排名查询某个名次段的人员

    先说一下表结构  名字name  分数fenshu   表名test1,以下查询的是成绩排名为第三名和第四名,这个模板让你查随意排名段的人 select name,fenshu,mc from (se ...

  7. 小程序QQ版表情解析组件

    代码片段: [https://developers.weixin.qq.com/s/KLaD5MmD7V45) GitHub: https://github.com/WozHuang/Miniprog ...

  8. 【Mockplus视频教程】《10分钟玩转Mockplus》

    地址:http://doc.mockplus.cn/?p=152

  9. Unity 相机花式分屏

    花式分屏,顾名思义,可以实现各种不规则几何边界的分屏,是无法直接通过调整相机视口能达到效果的(只能实现矩形的分屏),例如斜对角分屏,几何图形分屏: 假设我们有两个相机,需要上面的斜对角分屏画面,和镜子 ...

  10. Oracle创建用户以及备份还原数据库操作

    -- Create the user create user XX identified by "" default tablespace USERS temporary tabl ...