一个来自《操作系统设计与实现》中的问题?

huer0625 2010-03-21 08:05:50
#ifdef __GNU__
#define _ANSI 31459
#endif
请问31459有什么特别的涵义吗?
(书中,下册p7)
...全文
115 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
huer0625 2010-03-21
  • 打赏
  • 举报
回复
谢谢,我已经理解了。我结贴咯。参与者有份,但是根据问题答案给分吧。
cy330206 2010-03-21
  • 打赏
  • 举报
回复
学习一下。。
wesleyluo 2010-03-21
  • 打赏
  • 举报
回复
恩,学习下。
AlanBruce 2010-03-21
  • 打赏
  • 举报
回复
#define命令

TAG:预编译和宏定义,ANSI C,#define命令
TEXT:
#define命令主要可以实现两种功能:
1) 符号常量定义
2) 宏定义
2010-03-21
  • 打赏
  • 举报
回复
/* The <ansi.h> header attempts to decide whether the compiler has enough
* conformance to Standard C for Minix to take advantage of. If so, the
* symbol _ANSI is defined (as 31459). Otherwise _ANSI is not defined
* here, but it may be defined by applications that want to bend the rules.
* The magic number in the definition is to inhibit unnecessary bending
* of the rules. (For consistency with the new '#ifdef _ANSI" tests in
* the headers, _ANSI should really be defined as nothing, but that would
* break many library routines that use "#if _ANSI".)
AlanBruce 2010-03-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 huer0625 的回复:]
谢谢。但是如果只是为了防止重复定义,我完全可以这样定义。
#ifdef __GNU__
#define _ANSI
#endif
而不用后面的数据啊。呵呵
[/Quote]

那是为了使其成为一个常量啊
2010-03-21
  • 打赏
  • 举报
回复
我来猜一下,是不是指 ANSI 的版本号?
huer0625 2010-03-21
  • 打赏
  • 举报
回复
谢谢。但是如果只是为了防止重复定义,我完全可以这样定义。
#ifdef __GNU__
#define _ANSI
#endif
而不用后面的数据啊。呵呵
xiuxianshen 2010-03-21
  • 打赏
  • 举报
回复
具体不知道,但是应该没有特别含义,可能是个特定数字,防止重复编译罢了,
可以换个试试,应该没问题,呵呵

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧