<small id='RgRyO'></small><noframes id='RgRyO'>

      • <bdo id='RgRyO'></bdo><ul id='RgRyO'></ul>
    1. <i id='RgRyO'><tr id='RgRyO'><dt id='RgRyO'><q id='RgRyO'><span id='RgRyO'><b id='RgRyO'><form id='RgRyO'><ins id='RgRyO'></ins><ul id='RgRyO'></ul><sub id='RgRyO'></sub></form><legend id='RgRyO'></legend><bdo id='RgRyO'><pre id='RgRyO'><center id='RgRyO'></center></pre></bdo></b><th id='RgRyO'></th></span></q></dt></tr></i><div id='RgRyO'><tfoot id='RgRyO'></tfoot><dl id='RgRyO'><fieldset id='RgRyO'></fieldset></dl></div>

      <legend id='RgRyO'><style id='RgRyO'><dir id='RgRyO'><q id='RgRyO'></q></dir></style></legend>

        <tfoot id='RgRyO'></tfoot>

        以零开头的数字有什么特别之处?

        What is special about numbers starting with zero?(以零开头的数字有什么特别之处?)

        <legend id='kI8Nv'><style id='kI8Nv'><dir id='kI8Nv'><q id='kI8Nv'></q></dir></style></legend>

        <small id='kI8Nv'></small><noframes id='kI8Nv'>

        <i id='kI8Nv'><tr id='kI8Nv'><dt id='kI8Nv'><q id='kI8Nv'><span id='kI8Nv'><b id='kI8Nv'><form id='kI8Nv'><ins id='kI8Nv'></ins><ul id='kI8Nv'></ul><sub id='kI8Nv'></sub></form><legend id='kI8Nv'></legend><bdo id='kI8Nv'><pre id='kI8Nv'><center id='kI8Nv'></center></pre></bdo></b><th id='kI8Nv'></th></span></q></dt></tr></i><div id='kI8Nv'><tfoot id='kI8Nv'></tfoot><dl id='kI8Nv'><fieldset id='kI8Nv'></fieldset></dl></div>
                • <bdo id='kI8Nv'></bdo><ul id='kI8Nv'></ul>
                    <tbody id='kI8Nv'></tbody>
                  <tfoot id='kI8Nv'></tfoot>
                  本文介绍了以零开头的数字有什么特别之处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这个问题有点愚蠢,但对我来说很有趣)

                  This is kinda stupid question, but it's interesting for me )

                  这是我在 Visual Studio 2013 中得到的

                  This is what i get with visual studio 2013

                  int i = 07;     // i == 7
                  int i = 16;     // i == 16
                  int i = 00016;  // i == 14, why?
                  int i = 05016;  // i == 2574, wow )
                  int i = 08;     // compile error, compiler expects octal number...
                  

                  如果数字以零开头并包含 8,则为编译错误.这是正常的吗?如果 00016 == 14,编译器究竟对起始零做了什么?

                  If number starts with zero and contains 8, it's compile error. Is this normal? And what exactly compiler does with starting zeros if 00016 == 14?

                  谢谢大家))

                  推荐答案

                  是的,这是意料之中的.

                  Yes, this is expected.

                  [C++11: 2.14.2/1]: 整数文字 是没有句点或指数部分的数字序列.一个整型文字可能有一个指定其基数的前缀和一个指定其类型的后缀.数字序列的词汇第一个数字是最重要的.十进制 整数文字(以十为底)以 0 以外的数字开头,并由一系列十进制数字组成.一个八进制整数文字(基数为八)以数字 0 开头,由八进制数字序列组成.22十六进制 整数文字(十六进制)以 0x 或 0X 开头,由一系列十六进制数字组成,其中包括十进制数字和字母 a 到 f 和 A 到 F,十进制值为十到十五.[ 示例: 数字十二可以写成 12、014 或 0XC.——结束示例 ]

                  [C++11: 2.14.2/1]: An integer literal is a sequence of digits that has no period or exponent part. An integer literal may have a prefix that specifies its base and a suffix that specifies its type. The lexically first digit of the sequence of digits is the most significant. A decimal integer literal (base ten) begins with a digit other than 0 and consists of a sequence of decimal digits. An octal integer literal (base eight) begins with the digit 0 and consists of a sequence of octal digits.22 A hexadecimal integer literal (base sixteen) begins with 0x or 0X and consists of a sequence of hexadecimal digits, which include the decimal digits and the letters a through f and A through F with decimal values ten through fifteen. [ Example: the number twelve can be written 12, 014, or 0XC. —end example ]

                  22 数字 8 和 9 不是八进制数字.

                  这篇关于以零开头的数字有什么特别之处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)

                    <small id='ay8qc'></small><noframes id='ay8qc'>

                      <tbody id='ay8qc'></tbody>
                    <i id='ay8qc'><tr id='ay8qc'><dt id='ay8qc'><q id='ay8qc'><span id='ay8qc'><b id='ay8qc'><form id='ay8qc'><ins id='ay8qc'></ins><ul id='ay8qc'></ul><sub id='ay8qc'></sub></form><legend id='ay8qc'></legend><bdo id='ay8qc'><pre id='ay8qc'><center id='ay8qc'></center></pre></bdo></b><th id='ay8qc'></th></span></q></dt></tr></i><div id='ay8qc'><tfoot id='ay8qc'></tfoot><dl id='ay8qc'><fieldset id='ay8qc'></fieldset></dl></div>
                        • <bdo id='ay8qc'></bdo><ul id='ay8qc'></ul>
                          <legend id='ay8qc'><style id='ay8qc'><dir id='ay8qc'><q id='ay8qc'></q></dir></style></legend><tfoot id='ay8qc'></tfoot>