八进制数文字:什么时候?为什么?自从? [英] Octal number literals: When? Why? Ever?

查看:152
本文介绍了八进制数文字:什么时候?为什么?自从?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从来没有使用八进制数字在我的code,也遇到任何code,它用它(十六进制和位操作仍然)。

I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding).

我C / C ++ 1994年左右,所以也许我太年轻了这个开始编程?请问老年code使用八进制? C包括这些支持由prepending 0,但如果是使用这些基地8号在字面上code?

I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that uses these base 8 number literals?

推荐答案

最近,我不得不写网络协议code访问3位字段。当你想调试八路就派上用场了。

I recently had to write network protocol code that accesses 3-bit fields. Octal comes in handy when you want to debug that.

只是为了效果,你能告诉我这3位字段?

Just for effect, can you tell me what the 3-bit fields of this are?

0x492492

在另一方面,在八进制此相同数目

On the other hand, this same number in octal:

022222222

现在,终于,在二进制(以3组):

Now, finally, in binary (in groups of 3):

010 010 010 010 010 010 010 010

这篇关于八进制数文字:什么时候?为什么?自从?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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