Email or username:

Password:

Forgot your password?
Luna, but on a new instance

A lot of people don’t know this one weird trick — much like JavaScript, C also lets you perform arithmetic with mixed types:

Screenshot of a terminal showing a simple C program and its output.
The code prints the result of the expression `"-0.5" + 1`
The displayed output is 0.5
91 comments
Tenacious B (twoot.site edition)

@luna you know, sometimes I'm really in awe at how adept people can become at cursed C.

aoanla

@bean @luna the "exponential" is particularly full of evil, I "enjoyed" the minute or so I needed to fully appreciate it.
Possibly not portable to all architectures, though?

Steven Reed

@aoanla @bean @luna definitely won't work on EBCDIC machines ...

aoanla

@srtcd424 @bean @luna that was my first thought, yes! (I think the first number would have to be 242 maybe for it to work on EBCDIC?)

Luna, but on a new instance

@aoanla @srtcd424 @bean I put it to the both of you that using an EBCDIC machine in 2024 is far worse than anything I've written.

aoanla

@luna @srtcd424 @bean I think horrifying the horror counts as a win, right?

greeeeen :v_alloaro_2: (sometimes clover)

@luna@pony.social wait,, what would ** even do in C? it's not an operator,, right?

edit: i got it now. thanks everyone. can you stop explaining the joke now?

tekhedd

@luna I'm not sure how I feel about this.

Shane Celis

@me Omg, is ‘2’ 50 in ascii? Yes. Yes, it is.

Natty :butterflyN:

@luna@pony.social how the fuck does it deref to that perfect point in memory

koorogi

@luna that's very cute, but not strictly guaranteed to work because C doesn't assume ASCII compatible encodings.

phooky

@luna this one makes me irrationally angry for reasons i do not fully understand, thank you

UnknownSilicon

@luna Wow that is some of the most cursed C code I've seen LOL

scarcraft

@luna What font are you using in this capture?

Thanks

Moritz Poldrack :arch:

@luna no offence but I feel the urge to punch your computer.

Marc

@luna outch this one hurts. Congrats.

Félix

@luna from now on I want to see all programming shitposts in Comic Sans Mono

Luna, but on a new instance

@fay59 oh this is just the font I use for my shell anyways, I didn't choose it for the shitpost

Félix

@luna I figured that might be the case but I think you really stumbled onto something big here

Sam Brown

@luna Your revenge on the C programming language will never be complete, will it? :)

jadedctrl :programo:

@luna totally unrelated, sorry, but I’ve gotta ask — what font’re you using? :anja_adormiras:

Schaf

@luna not sure is this is even legal

Dag Ågren ↙︎↙︎↙︎

@schaf @luna It's legal by the C language standard, but not by the church.

серафими многоꙮчитїи

@luna brb trying to explain to the villagers why they need to bring flaming torches and pitchforks

(brilliant work, so underhanded it does exactly what you expect it to)

Matthew Garrett

@luna Staring at this very confused until I realised I was thinking in hex and not decimal

Chris Gerhard :bt:

@luna part of me hopes that that code is in a from that the AI's can read...

DELETED

@luna oh, U C-ve me, but i'm not in C anymore :blobcatcookienom:

Markus 🤓✨

@luna is that one of those Comic Sans mono fonts? Love it. :D

mmu_man

@luna cool, now let LLM learn that 🙂

Urix Turing

@luna I was so upset, then I was so amazed 🤩

Morgan

@luna this is actually a big motivation for me to learn C, one of the things that annoys me the most about other statically typed languages is getting errors for trying to multiply 100 by 0.6 etc

Matt

@luna calculating like the original turing machine! :D

Z̡̭͆́E̲͞n͇̘̔̕ ̈R̬̦̃͘I̛͖o̡̟͑͒t

@luna

have some functional programming in C

also cool I didn't know bat before, thanks.

Cinnamon

@luna@pony.social I'm going to apply that trick to my next self driving car. Would you like to come for a ride? ​:blobcatgiggle2:​

KasTas

@luna I hope not to see this in production. Never. Despite... being funny.

And tragic.

At the same time.

Go Up