使用C,我是否认为以多个零开头的文字被认为是八进制的? [英] Using C am I right in thinking that literals beginning with multiple zeros are considered octal?

查看:100
本文介绍了使用C,我是否认为以多个零开头的文字被认为是八进制的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的C代码中,所有这些定义都使用八进制文字吗?即使它们以多个零开头?

In the following C code are octal literals used for all these defines? Even if they start with multiple zeros?

#define TCL_REG_BASIC       000000  /* BREs (convenience). */
#define TCL_REG_EXTENDED    000001  /* EREs. */
#define TCL_REG_ADVF        000002  /* Advanced features in EREs. */
#define TCL_REG_ADVANCED    000003  /* AREs (which are also EREs). */
#define TCL_REG_QUOTE       000004  /* No special characters, none. */
#define TCL_REG_NOCASE      000010  /* Ignore case. */
#define TCL_REG_NOSUB       000020  /* Don't care about subexpressions. */
#define TCL_REG_EXPANDED    000040  /* Expanded format, white space & comments. */
#define TCL_REG_NLSTOP      000100  /* \n doesn't match . or [^ ] */
#define TCL_REG_NLANCH      000200  /* ^ matches after \n, $ before. */
#define TCL_REG_NEWLINE     000300  /* Newlines are line terminators. */
#define TCL_REG_CANMATCH    001000  /* Report details on partial/limited * matches. */

推荐答案

摘自C标准6.4.4.1第3段:

From C Standard, 6.4.4.1 Paragraph 3:

一个八进制常量由前缀0组成,可以选择在其后跟随一个仅由数字0到7组成的序列

An octal constant consists of the prefix 0 optionally followed by a sequence of the digits 0 through 7 only

这篇关于使用C,我是否认为以多个零开头的文字被认为是八进制的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆