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

<p>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?</p>

[{'answer_id': 44575, 'author': 'Greg Hewgill', 'author_id': 893, 'author_profile': 'https://Stackoverflow.com/users/893', 'pm_score': 3, 'selected': False, 'text': "<p>It's useful for the <code>chmod</code> and <code>mkdir</code> functions in Unix land, but aside from that I can't think of any other common uses.</p>\n"}, {'answer_id': 44587, 'author': 'Adam Davis', 'author_id': 2915, 'author_profile': 'https://Stackoverflow.com/users/2915', 'pm_score': 5, 'selected': False, 'text': '<p>From <a href="http://en.wikipedia.org/wiki/Octal" rel="noreferrer">Wikipedia</a></p>\n\n<blockquote>\n  <p>At the time when octal originally\n  became widely used in computing,\n  systems such as the IBM mainframes\n  employed 24-bit (or 36-bit) words.\n  Octal was an ideal abbreviation of\n  binary for these machines because\n  eight (or twelve) digits could\n  concisely display an entire machine\n  word (each octal digit covering three\n  binary digits). It also cut costs by\n  allowing Nixie tubes, seven-segment\n  displays, and calculators to be used\n  for the operator consoles; where\n  binary displays were too complex to\n  use, decimal displays needed complex\n  hardware to convert radixes, and\n  hexadecimal displays needed to display\n  letters. </p>\n  \n  <p>All modern computing\n  platforms, however, use 16-, 32-, or\n  64-bit words, with eight bits making\n  up a byte. On such systems three octal\n  digits would be required, with the\n  most significant octal digit\n  inelegantly representing only two\n  binary digits (and in a series the\n  same octal digit would represent one\n  binary digit from the next byte).\n  Hence hexadecimal is more commonly\n  used in programming languages today,\n  since a hexadecimal digit covers four\n  binary digits and all modern computing\n  platforms have machine words that are\n  evenly divisible by four. Some\n  platforms with a power-of-two word\n  size still have instruction subwords\n  that are more easily understood if\n  displayed in octal; this includes the\n  PDP-11. The modern-day ubiquitous x86\n  architecture belongs to this category\n  as well, but octal is almost never\n  used on this platform.</p>\n</blockquote>\n\n<p>-Adam</p>\n'}, {'answer_id': 44590, 'author': 'Ben Collins', 'author_id': 3279, 'author_profile': 'https://Stackoverflow.com/users/3279', 'pm_score': 7, 'selected': True, 'text': '<p>I recently had to write network protocol code that accesses 3-bit fields.  Octal comes in handy when you want to debug that.  </p>\n\n<p>Just for effect, can you tell me what the 3-bit fields of this are?</p>\n\n<pre><code>0x492492\n</code></pre>\n\n<p>On the other hand, this same number in octal:</p>\n\n<pre><code>022222222\n</code></pre>\n\n<p>Now, finally, in binary (in groups of 3):</p>\n\n<pre><code>010 010 010 010 010 010 010 010\n</code></pre>\n'}, {'answer_id': 44594, 'author': 'Chris AtLee', 'author_id': 4558, 'author_profile': 'https://Stackoverflow.com/users/4558', 'pm_score': 5, 'selected': False, 'text': '<p>The only place I come across octal literals these days is when dealing with the permission bits on files in Linux, which are normally represented as 3 octal digits, where each digit represents the permissions for the file owner, group and other users respectively.</p>\n\n<p>e.g. 0755 (also just 755 with most command line tools) means the file owner has full permissions (read, write, execute), and the group and other users just have read and execute permissions.</p>\n\n<p>Representing these bits in octal makes it easier to figure out what permissions are set.  You can tell at a glance what 0755 means, but not 493 or 0x1ed.</p>\n'}, {'answer_id': 44609, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>I came into contact with Octal through <a href="http://www.retrologic.com/jargon/P/PDP-11.html" rel="nofollow noreferrer">PDP-11</a>, and so, apparently, did the C language :)</p>\n'}, {'answer_id': 44646, 'author': 'John Meagher', 'author_id': 3535, 'author_profile': 'https://Stackoverflow.com/users/3535', 'pm_score': 3, 'selected': False, 'text': '<p>I have also seen octal used in aircraft transponders.  A mode-3a transponder code is a 12-bit number that everyone deals with as 4 octal numbers.  There is a bit more information on <a href="http://en.wikipedia.org/wiki/Transponder_%28aviation%29" rel="noreferrer">Wikipedia</a>.  I know it\'s not generally computer related, but the FAA uses computers too :). </p>\n'}, {'answer_id': 1231148, 'author': 'Samuel Lee', 'author_id': 150782, 'author_profile': 'https://Stackoverflow.com/users/150782', 'pm_score': 3, 'selected': False, 'text': '<p>Commercial Aviation uses octal "labels" (basically message type ids) in the venerable Arinc 429 bus standard. So being able to specify label values in octal when writing code for avionics applications is nice...</p>\n'}, {'answer_id': 1579177, 'author': 'nvuono', 'author_id': 87464, 'author_profile': 'https://Stackoverflow.com/users/87464', 'pm_score': 2, 'selected': False, 'text': '<p>There are still a bunch of old Process Control Systems (Honeywell H4400, H45000, etc) out there from the late 60s and 70s which are arranged to use 24-bit words with octal addressing. Think about when the last nuclear power plants were constructed in the United States as one example.</p>\n\n<p>Replacing these industrial systems is a pretty major undertaking so you may just be lucky enough to encounter one in the wild before they go extinct and gape in awe at their magnificent custom floating point formats!</p>\n'}, {'answer_id': 1619486, 'author': 'Mandrake', 'author_id': 192561, 'author_profile': 'https://Stackoverflow.com/users/192561', 'pm_score': 2, 'selected': False, 'text': '<p>tar files store information as an octal integer value string</p>\n'}, {'answer_id': 1619498, 'author': 'Tim', 'author_id': 188691, 'author_profile': 'https://Stackoverflow.com/users/188691', 'pm_score': 5, 'selected': False, 'text': '<blockquote>\n  <p>I have never used octal numbers in my\n  code nor come across any code that\n  used it.</p>\n</blockquote>\n\n<p>I bet you have. According to the standard, numeric literals which start with zero are octal. This includes, trivially, <code>0</code>. Every time you have used or seen a literal zero, this has been octal. Strange but true. :-)</p>\n'}, {'answer_id': 2417564, 'author': 'PrgTrdr', 'author_id': 213625, 'author_profile': 'https://Stackoverflow.com/users/213625', 'pm_score': 2, 'selected': False, 'text': '<p>Anyone who learned to program on a PDP-8 has a warm spot in his heart for octal numbers.  Word size was 12 bits divided into 4 groups of 3 bits each, so -1 was 7777 octal.  This scheme was perpetuated in the PDP-11 which had 16 bit words but still used octal representation for various things, hence the *NIX file permission scheme which lives to this day.</p>\n'}, {'answer_id': 5502290, 'author': 'JAMES', 'author_id': 686034, 'author_profile': 'https://Stackoverflow.com/users/686034', 'pm_score': 1, 'selected': False, 'text': '<p>Octal is and was most useful with the first available display hardware (7-segment displays). These original displays did not have the decoders available later.</p>\n\n<p>Thus the digital register outputs were grouped to fit the available display which was capable of only displaying eight(8) symbols: 0,1,2 3,4,5,6,7 .</p>\n\n<p>Also the first CRT display tubes were raster scan displays and simplest character-symbol generators were equivalent to the 7-segment displays.</p>\n\n<p>The motivating driver was, as always, the least expensive display possible. </p>\n'}, {'answer_id': 21176121, 'author': 'Dale Amon', 'author_id': 3204824, 'author_profile': 'https://Stackoverflow.com/users/3204824', 'pm_score': 2, 'selected': False, 'text': '<p>There is no earthly reason to modify a standard that goes back to the birth of the language and which exists in untold numbers of programs. I still remember ASCII characters by their\noctal values, would have to think to come up with the hex value of A, but it is 101 in octal; numeric 0 is 060... ^C is 003...</p>\n\n<p>That is to say, I often use the octal representation.</p>\n\n<p>Now if you really want to bend your mine, take a look at the word format for the PDP-10...</p>\n'}]
['https://Stackoverflow.com/questions/44569', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2543/']