this post was submitted on 31 Oct 2023
831 points (96.3% liked)

Programmer Humor

32410 readers
625 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 

toot by @nixCraft@mastodon.social

you are viewing a single comment's thread
view the rest of the comments
[–] Even_Adder@lemmy.dbzer0.com 61 points 1 year ago (4 children)

I just wanted a short explanation.

Is this even right?

[–] MrRazamataz@lemmy.razbot.xyz 43 points 1 year ago (1 children)

In the language man I wonder what the language is

[–] Even_Adder@lemmy.dbzer0.com 9 points 1 year ago (1 children)

I bet I lost that part of the explanation when I asked for layman's terms.

[–] Masimatutu@lemm.ee 19 points 1 year ago (1 children)

Nah, pretty sure that is just a (very mild) hallucination because it couldn't find an actual good example

[–] Knusper@feddit.de 5 points 1 year ago

Yeah, problem is that I'm not aware of anyone who actually writes octal numbers as "OCT123" nor decimal numbers as "DEC123". It's basically a made-up syntax, supposed to look plausible for both date notation and number system notation. It's part of the joke, which LLMs won't understand.

[–] Masimatutu@lemm.ee 27 points 1 year ago (1 children)
[–] Even_Adder@lemmy.dbzer0.com 6 points 1 year ago

Cool, the plausible answers are always the most dangerous.

[–] driving_crooner@lemmy.eco.br 5 points 1 year ago* (last edited 1 year ago) (1 children)

Except for the part about using OCT or DEC to talk about octal and decimal numbers is ok.

From wikipedia:

In programming languages, octal literals are typically identified with a variety of prefixes, including the digit 0, the letters o or q, the digit–letter combination 0o, or the symbol &[12] or $. In Motorola convention, octal numbers are prefixed with @, whereas a small (or capital[13]) letter o[13] or q[13] is added as a postfix following the Intel convention.[14][15] In Concurrent DOS, Multiuser DOS and REAL/32 as well as in DOS Plus and DR-DOS various environment variables like $CLS, $ON, $OFF, $HEADER or $FOOTER support an \nnn octal number notation,[16][17][18] and DR-DOS DEBUG utilizes \ to prefix octal numbers as well.

For example, the literal 73 (base 8) might be represented as 073, o73, q73, 0o73, \73, @73, &73, $73 or 73o in various languages.

Newer languages have been abandoning the prefix 0, as decimal numbers are often represented with leading zeroes. The prefix q was introduced to avoid the prefix o being mistaken for a zero, while the prefix 0o was introduced to avoid starting a numerical literal with an alphabetic character (like o or q), since these might cause the literal to be confused with a variable name. The prefix 0o also follows the model set by the prefix 0x used for hexadecimal literals in the C language; it is supported by Haskell,[19] OCaml,[20] Python as of version 3.0,[21] Raku,[22] Ruby,[23] Tcl as of version 9,[24] PHP as of version 8.1,[25] Rust[26] and it is intended to be supported by ECMAScript 6[27] (the prefix 0 originally stood for base 8 in JavaScript but could cause confusion,[28] therefore it has been discouraged in ECMAScript 3 and dropped in ECMAScript 5[29]).

I think 0o31 would be the "correctish" way a programmer/computer scientist would talk about it.

[–] ChaoticNeutralCzech@feddit.de 8 points 1 year ago

Advanced calculators (both physical ans virtual) have DEC/BIN/OCT/HEX buttons so there is some truth to this abbreviation.

[–] Mac@mander.xyz 1 points 1 year ago

Is anyone else bothered by how often things are reiterated in this reply?