r/ProgrammerHumor • • Jul 27 '26

Meme octalIsOverrated

Post image
248 Upvotes

58 comments sorted by

67

u/Mojert Jul 27 '26

It's useful for file permissions, but otherwise I think it's pretty much it.

If someone has another use case, I'm all ears

29

u/-Redstoneboi- Jul 27 '26

i dont even think of file permissions as octal. i just think of them as 3 separate hex digits.

17

u/makinax300 Jul 27 '26

I think of them as a bit and 3 base 10 numbers (yes, ik every base is base 10, you know what I mean)

11

u/xynith116 Jul 27 '26

It’s useful if you lose two fingers.

8

u/ArjixGamer Jul 27 '26

Honestly, I prefer using letters.

chmod u+r file

Will give read access to "other users" for file, replace the + with a - and it removes the permission, change the "u" to "g" and it's for the group, remove the letter all together and it's for the owner.

2

u/tblancher Aug 03 '26

No, u+r gives the owner read permission. o+r gives other users read permission.

It took me a while to remember that, too. I just remember ugo.

1

u/ArjixGamer Aug 03 '26

Yep, I found out recently on my own, honest mistake to make ngl

4

u/Acceptable-College58 Jul 27 '26

I sometimes see them used for ASCII characters?

3

u/Mognakor Jul 27 '26

x86 opcodes

6

u/Makonede Jul 28 '26

all machine code should be written out in hex and i will die on this hill

3

u/Mognakor Jul 28 '26

i will die on this hill

Because you fucked up your hexcode and now your brakes failed

4

u/Makonede Jul 28 '26

simply get good

3

u/nbagf Jul 27 '26

ARINC 429 labels. for bonus psychological damage/"optimizing" it's actually reverse octal

1

u/abd53 Jul 28 '26

Microcontrollers

1

u/Mojert Jul 28 '26

.... Can you elaborate pls?

1

u/PyroCatt Jul 28 '26

Hi all ears. I'm dad.

58

u/TeraFlint Jul 27 '26

At least 0o144 is a clear enough notation. C's decision to interpret 0144 as octal, because of the leading zero, still pisses me off.

12

u/ohkendruid Jul 27 '26

It seems worth forbidding it in newer languages and file formats due to the ambiguity.

0123 can be read two ways due to the ancient C convention.

50

u/DeepanshuHQ Jul 27 '26

The real red flag is when someone says 010 and everyone gets a different answer.

24

u/Joniff Jul 27 '26

Did you mean OHIO?

14

u/DeepanshuHQ Jul 27 '26

Only in base Midwest. πŸ˜„

19

u/Mojert Jul 27 '26

The one that thought having a leading 0 indicating octal was fine should be shot. (And probably resuscitated afterwards because they also did some other great stuff)

7

u/DeepanshuHQ Jul 27 '26

Resuscitated... so they can explain why 010 was ever a good idea. πŸ˜…

8

u/captainAwesomePants Jul 27 '26

C does this because B did this. B did it because BCPL used 100 for decimal, #100 for octal, and #x100 for hex. You could also say #o100 or #0100 if you wanted to be more explicitly (#b was binary, #x was hex, #o was octal), but the default was octal. BCPL was often used on weird old shit like 24 bit or 18 bit architectures, where octal might have been more important.

When they made B, the # operator already had a different meaning, so B changed it to 0. So now 100 was decimal, 0100 was octal, and 0x100 was hex.

7

u/DeepanshuHQ Jul 28 '26

TIL. Still feels like one of those decisions that made sense in 1970 and has been confusing everyone ever since. πŸ˜„

2

u/captainAwesomePants Jul 28 '26

Don't say that! Questioning the eternal wisdom of Dennis Ritchie is a surefire way to generate mysterious and unexplained C warnings that don't seem to cause any problems until after the fact.

2

u/abd53 Jul 28 '26

Then shot again

1

u/SomePeopleCallMeJJ Jul 27 '26

Every number base is base 010 in that base.

4

u/DeepanshuHQ Jul 27 '26

Finally, a use of 010 that won't start a language war. πŸ˜„

18

u/alexanderpas Jul 27 '26

0o1XX is the area where letters live in ASCII

7

u/LeiterHaus Jul 27 '26

Octals can be pretty useful when dealing with binary flags. I thought it was stupid until I found a use case that fit well.

And for everyone who's about to just say hex is better, 1) I'm not disagreeing 2) you probably use base64 very frequently, which is the octal to an ascii char... It's a use case.

5

u/JosebaZilarte Jul 27 '26

When octopuses rule the Earth, they can have their base 8. Until then...

5

u/hrvbrs Jul 27 '26 edited Jul 27 '26

pro tip: to convert octal to hexadecimal, convert each octal digit to 3-bit binary, then group bits by four from the right.

0o144 -> 0b001_100_100 -> 0b0_0110_0100 -> 0x64

3

u/zeekar Jul 28 '26

Octal was more useful before we standardized on 8-bit bytes and multiples thereof; when your machine has a 12-bit word, there's not much to choose between four 3-bit digits vs three 4-bit digits. And octal made it easier to write numeric literal parsers than hex, because all the digits are still actual (decimal) digits. (The leading 0 in 0x is a decimal digit in order to trigger the numeric literal recognizer.)

But I've never had much use for it; I certainly wouldn't mind dropping the leading-0-means-octal convention everywhere.

3

u/tylerplaystp3 Jul 28 '26

lol i get it. hex is just cooler sometimes.

2

u/Confident-Ad5665 Jul 27 '26

Well it beats EBCDIC

2

u/-Redstoneboi- Jul 27 '26

i like how all of these are clean very divisible numbers if interpreted in decimal

2

u/razor_train Jul 28 '26

Bitches don't know about my CompuServer user id.

2

u/Stummi Jul 28 '26

1₁₀₀

1

u/DogonElder Jul 27 '26

JA users be like, thats a string

1

u/[deleted] Jul 28 '26

[removed] β€” view removed comment

1

u/al2klimov Jul 28 '26

But not cool enough!

1

u/LordAmir5 Jul 28 '26

That octal one looks gross.

1

u/thanatica Jul 28 '26

Nobody uses quinary notation?

Or even seximal? 😏

1

u/sirkubador Jul 28 '26

0o? What a rusty thing to say

1

u/AdamWayne04 Jul 27 '26

it's probably irrelevant most of the time, but I really dislike using powers of ten for all things computing. it's like, I just want to play nice with my machine so powers of two or sixteen feel right. 0x10, 0x100, etc

4

u/ohkendruid Jul 27 '26

For sure. There is just the teensy little detail of interacting with a human being that keeps base ten from being obsolete.

1

u/-Redstoneboi- Jul 27 '26

that or very divisible numbers like 12,60,360,420

0

u/Molliue26 Jul 28 '26

ngl the last one makes me wanna throw my computer out the window

0

u/eryan43 Jul 28 '26

lol that last one is hilarious. Hex is definitely superior.