Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6054643
  • 博文数量: 2759
  • 博客积分: 1021
  • 博客等级: 中士
  • 技术积分: 4091
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-11 14:14
文章分类

全部博文(2759)

文章存档

2019年(1)

2017年(84)

2016年(196)

2015年(204)

2014年(636)

2013年(1176)

2012年(463)

分类: C/C++

2014-09-11 11:56:33

前言:
    在阅读国外源码的时候,发现很多宏定义中 #define 中有空格(# define),特别是在 #if , #else , #endif 中。

一,测试

点击(此处)折叠或打开

  1. #include <stdio.h>

  2. #define f_str "#define"

  3. # define s_str "# define"



  4. int main(int argv,char *argc[])
  5. {
  6.     printf("%s\n",f_str);
  7.     printf("%s\n",s_str);

  8.     return 0;
  9. }
    测试结果:
    

    结论:
        在 C 语言中,宏定义《#define》 和 宏定义 《# define》 都是可以编译通过的,且功能一样的

    猜测:
        这个可能是为了提高代码的可读性
        
        
阅读(1144) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~