当前位置: 首页 > news >正文

C:宏:编程风格:井号与define之间的空格

在这一篇中有提到,井号与define之间空格,可能导致搜索上的一些问题。
https://mzhan017.blog.csdn.net/article/details/135289451

今天看到有专门做这个空格的修改:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fcf70d4114db9ff7923f5dfeb3fea6e2d623e5c2;hp=3f3822198993be18d4d9ccb1593eea274dbd2ba0

应该是为了阅读代码的方便性,因为如果不加空格会对代码阅读造成一定的困难;但是为什么不直接将整个#define都缩进呢?例如下面的一段
glibc/elf/dl-load.h

/* The right way to map in the shared library files is MAP_COPY, whichmakes a virtual copy of the data at the time of the mmap call; thisguarantees the mapped pages will be consistent even if the file isoverwritten.  Some losing VM systems like Linux's lack MAP_COPY.  All weget is MAP_PRIVATE, which copies each page when it is modified; thismeans if the file is overwritten, we may at some point get some pagesfrom the new version after starting with pages from the old version.To make up for the lack and avoid the overwriting problem,what Linux does have is MAP_DENYWRITE.  This prevents anyonefrom modifying the file while we have it mapped.  */
#ifndef MAP_COPY
# ifdef MAP_DENYWRITE
#  define MAP_COPY      (MAP_PRIVATE | MAP_DENYWRITE)
# else
#  define MAP_COPY      MAP_PRIVATE
# endif
#endif

应个人的阅读爱好,其实只要养成一种阅读习惯,就可以,不管是前加空格还是后加空格,只要可用表示出if缩进块的功能就好。

http://www.lryc.cn/news/273569.html

相关文章:

  • django websocket
  • HackTheBox - Medium - Linux - Bagel
  • Capsolver:解决Web爬虫中CAPTCHA挑战的最优解决方案
  • 大数据系列之:读取parquet文件统计数据量
  • 力扣题:字符串变换-1.5
  • el-autocomplete远程搜索使用及el-upload上传多个文件流给后端,详情接口返回的是文件地址,前端将文件地址转成文件流,回传文件流给后端
  • 2024年度 ROTS - 实时操作系统 Top 15
  • 苹果怎么同步备忘录?教程来了,干货满满!
  • Nginx(十八) 性能调优之 - 哪些层面可以进行优化
  • OpenStack云计算(三)neutron
  • Linux期末复习笔记
  • PHP实现多继承
  • pulsar原来是这样操作topic的
  • 日常工作 经验总结
  • 【Proteus仿真】【Arduino单片机】水箱液位监控系统
  • 【已解决】若依系统前端打包后,部署在nginx上,点击菜单错误:@/views/system/role/index
  • Java中compareTo方法使用
  • 【霹雳吧啦】手把手带你入门语义分割の番外11:U2-Net 源码讲解(PyTorch)—— 代码的使用
  • 威尔仕2023年的统计数据
  • Spring——Spring基于注解的IOC配置
  • spring常用注解(一)springbean生命周期类
  • 【软件测试】2024年准备中/高级测试岗技术面试...
  • 第11课 实现桌面与摄像头叠加
  • SAP 检验批状态修改(QA32质检放行报错:BS002 不允许 “访问使用决定“ (INL 101105415 ))
  • 华为交换机如何同时配置多个端口参数
  • Mybatis之多表查询
  • 部署node.js+express+mongodb(更新中)
  • 百度CTO王海峰:文心一言用户规模破1亿
  • 简单最短路径算法
  • 答案解析——C语言—第3次作业—算术操作符与关系操作符