Pre-ANSI C's Surprising Octal Number System
Description
This image is a screenshot of a technical document, likely a programming manual, with a white background and black text. The headings read '2.3 Constants' and '2.3.1 Integer constants'. The main text describes integer constants, stating they are octal if they begin with 0. The most prominent part is a sentence with red underlines beneath each word: 'The digits 8 and 9 have octal value 10 and 11 respectively.' In the bottom right, there is a watermark that says 'More fun at https://t.me/dev_meme'. This is a deep technical joke for experienced programmers, especially those familiar with the history of the C language. The humor comes from the obscurity and counter-intuitive nature of this language rule from pre-standardized, or 'Pre-ANSI', C. In modern computing, the octal number system (base-8) exclusively uses the digits 0 through 7. The idea that 8 and 9 could be considered part of an octal representation is absurd by today's standards. This historical artifact from the Bell Labs C manual highlights how language specifications can evolve and how what is considered fundamental today was once different
Comments
57Comment deleted
Modern compilers give you errors for invalid octal digits. The original C compiler just shrugged and implemented integer promotion with extra steps. It's not a bug, it's a historical feature
Pre-ANSI C let 8 and 9 into octal - proof that feature creep can hit even numeral systems, and why the legacy billing job still thinks 089 is “undefined revenue.”
After 20 years in the industry, I've learned that C's octal literals with leading zeros have caused more production incidents than Y2K - at least Y2K had a marketing budget and consultants warning us about it
Ah yes, the classic C octal trap - where padding your numbers with a leading zero for 'alignment' suddenly transforms 08 into a compiler error, because apparently Dennis Ritchie thought developers in the 1970s desperately needed a shorthand for base-8 literals. Nothing says 'intuitive language design' quite like silently reinterpreting 0755 as 493 decimal while making 0888 a syntax error. It's the gift that keeps on giving, especially when junior devs wonder why their 'lucky number' 007 doesn't equal seven, and senior architects still debate whether this feature was genius foresight for Unix file permissions or just technical debt we've been carrying since bell-bottoms were fashionable
Legacy reminder: a leading zero turns your constant into octal - 010 is 8, 08 is a build failure, and 09 is a company-wide retrospective
Classic C ergonomics: one stray leading 0 turns 09 into a compile error while the doc promotes 8 and 9 to octal - my lexer just filed a bug against the author
Octal literals now go to 11 - like Spinal Tap volumes, but for the C standard's off-by-one in digit values
You posted it up there Comment deleted
https://t.me/dev_meme/5498 Like here Comment deleted
And what's wrong with that? Comment deleted
imagine writing binary number 01001019 Comment deleted
That's wrong Comment deleted
And what's wrong with that? :) Comment deleted
9 in binary Comment deleted
bingo Comment deleted
valid octal digit, not binary digit Comment deleted
i see what i missed Comment deleted
here you have binary Comment deleted
does word "imagine" mean anything to you? Comment deleted
not really Comment deleted
here, have a "valid" octal number: 0789 Comment deleted
that's not valid Comment deleted
you just claimed that the channel admin is lying Comment deleted
nope Comment deleted
That's wrong Comment deleted
did i somewhere said that is valid? Comment deleted
yes the fucking post you are commenting under Comment deleted
Post have nothing similar with the documentation that literally tells that thing: 8 = 010 9 = 011 Comment deleted
do you have any idea what digit is? Comment deleted
Digits are the single numbers used to represent values in math. 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 are used in different combinations and repetitions to represent all the values in math. Any of the ten numbers from 0 to 9 can be represented by a symbol known as a digit. Comment deleted
I think OP made up things outta his ass and claimed that the octals in pre ansi c had decimal digits as valid octal digits, so 08 and 09 woulda resolve to something. But I think op's reading skills is lacking and he took examples as actual values Comment deleted
And what's wrong with the pic? Comment deleted
it's literally doing the same thing you just said is wrong Comment deleted
How? Comment deleted
man, you are wrong Comment deleted
8 in decimal is 10 in octal Comment deleted
What's wrong? Comment deleted
octal digit Comment deleted
8 = 010 9 = 011 Comment deleted
Where's the problem? Comment deleted
oh i'm dying lmao Comment deleted
YEAH, NO SHIT? Comment deleted
it was valid in C literal because, as i understand, C was transforming them Comment deleted
guys all of this is about pre-ansi C converting any number interpreted as octal to the decimal equivalent by itself Comment deleted
So 8 and 9 are valid decimal digits that have 10 and 11 octal values respectively Comment deleted
dev meme admin is trying to tear us apart, we have to stay strong Comment deleted
Strength with Unity Unity with Faith Comment deleted
In octal only valid digits are 0-7, so decimal 8 in octal is 10 and decimal 9 in octal is 11. That’s what the manual is saying. Same as to say 2 in decimal is 10 in binary and 3 in decimal is 11 in binary. So nothing wrong is there Comment deleted
Yesss, let’s explain to best engineers in the field what octal notation is 🎉 This is what standards for languages are made for, right? Comment deleted
well, again, this is pre-ansi C, so that's no standard, that's at best internal documentation, and at worst someone's attempt at explaining some company's internal compiler Comment deleted
Maybe you believe you are some sort of The Field Greatest Mind Wizard and because of this you see something that others don't see, but all this post basically is: Comment deleted
But why not do it like every other base does? 36282 is decimal, 0x352416 is hexadecimal, 0b10100101010 is binary. Why not use 0o15272517 to be octal Comment deleted
Or am I missing something? Comment deleted
you can omit o in octal and just start it with 0. works till this day Comment deleted
Here is another post that proves that 8 and 9 were valid octal digits, with an additional source as a proof. https://twitter.com/shafikyaghmour/status/991913614977060866 Comment deleted
Can someone explain to me where the fuck is octal system used nowadays? Or its not actually? I learn C++ for 3 years, only mention of it is that there is IO manipulator for it Comment deleted
some doc says 2+2=4! Comment deleted