603
no cap (lemmy.ml)
submitted 1 year ago by gpw@lemmy.ml to c/programmerhumor@lemmy.ml
all 35 comments
sorted by: hot top controversial new old
[-] JuxtaposedJaguar@lemmy.ml 57 points 1 year ago

Reminds me of lolcode:

HAI 1.2
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
    AWSUM THX
        VISIBLE FILE
    O NOES
        INVISIBLE "ERROR!"
KTHXBYE
[-] fluxion@lemmy.world 51 points 1 year ago

And that's how rappers became the top programmers in the industry

[-] gpw@lemmy.ml 25 points 1 year ago

Can't wait to see Lil Yachty around work

[-] Lilium@lemmy.blahaj.zone 41 points 1 year ago

Artistry, on god frfr ๐Ÿ™๐Ÿ™

[-] aseriesoftubes@lemmy.world 35 points 1 year ago

I have to say, I like the substitution of yeet for return. No cap.

[-] gpw@lemmy.ml 22 points 1 year ago

All of my returns are going to be yeet from now on

My code reviewers will respond to my commits with on god ๐Ÿ™

My manager will do girl math to determine my next raise

#zoom

[-] technohacker@programming.dev 5 points 1 year ago

Rust has an RFC that wants to consider yeet as a keyword for throwing an exception, I think they're currently keeping it as a placeholder just in case

[-] vanZuider@feddit.de 4 points 1 year ago

AFAIK they're not seriously considering it as a keyword, but they agreed that in all discussion about the semantics of exceptions they will use "yeet" as a placeholder for the keyword, so people will actually discuss the semantics and not whether the keyword is gonna be "raise", "throw", "except" or whatever (so-called Bikeshed Effect)

[-] grue@lemmy.ml 26 points 1 year ago

Pro tip: the arguments to main() don't have to be named argc and argv.

Also, you forgot to #define an alias for atoi, and number, n, and i could've been named something more on fleek.

[-] bronzle@lemm.ee 6 points 1 year ago* (last edited 1 year ago)

Also could have takin out mains return type and used sus chief

[-] darcy@sh.itjust.works 2 points 1 year ago

number is a variable i think

[-] grue@lemmy.ml 5 points 1 year ago

Yes, as are n and i. Do they not deserve 'fleekness?'

[-] darcy@sh.itjust.works 1 points 1 year ago

sorry i misread. i thought u meant number was not #define'd

[-] db2@sopuli.xyz 23 points 1 year ago* (last edited 1 year ago)

Does it make me a bad person that I like this?

Edit: wait.. return ! 0 ; wtf

Edit 2: idc still like it frfr no cap

[-] grue@lemmy.ml 5 points 1 year ago

Edit: waitโ€ฆ return ! 0 ; wtf

I mean, returning non-zero exit status on error is just good practice. It even managed to evaluate to the same numerical value as EXIT_FAILURE when I tested it on my machine (gcc 11.4.0 linux x86-64), although I'm not sure if that's always the case or if it's undefined behavior.

This cursed code is quite well-written.

[-] bronzle@lemm.ee 5 points 1 year ago

!0 is defined as 1, thatโ€™s how argv [ no cap ] works, that and the ridiculous argc check stood out as a bit off, but works

[-] MrNoodleBox@lemm.ee 20 points 1 year ago

Reminds me of Rockstar. The example also implements Fizz Buzz.

[-] rt136us@sh.itjust.works 4 points 1 year ago

That's my favorite esoteric programming language!

[-] bronzle@lemm.ee 19 points 1 year ago* (last edited 1 year ago)

For those curious:

int main(int argc, char **argv) {
  if ( -- argc != ! 0 ) {
    errx ( ! 0 , "shheiiiit" ) ;
    return ! 0 ;
  }
  
  int number = atoi ( argv[! 0] ) ;

  for ( int i = ! 0 ; i <= number ; ++ i ) {
    printf ( "%3d " , i) ;
    
    if ( i % 3 == 0 ) {
      printf ( "fizz" ) ;
    }
  
    if ( i % 5 == 0 ) {
      printf ( "buzz" ) ;
    }
    printf ( "\n" ) ;
  }
  return 0 ;
}
[-] NegativeLookBehind@kbin.social 18 points 1 year ago
[-] gpw@lemmy.ml 24 points 1 year ago

The path to salvation is filled with terrors and temptation

no cap

[-] BleatingZombie@lemmy.world 17 points 1 year ago

I hate this. Where do I find more?

[-] grue@lemmy.ml 7 points 1 year ago
[-] Zucca@sopuli.xyz 3 points 1 year ago

Holy unholiness, Batman!

I did expect those kinds of tricks would cause syntax error in #defines, but instead looks like everything is allowed... Some day someone #defines a such abomination that it creates universe wide black hole -like vacuum and everything ceases to exist.

[-] RickyRigatoni@lemmy.ml 14 points 1 year ago
[-] Zucca@sopuli.xyz 4 points 1 year ago

I'm not a C programmer (is this code even C?), but I anticipated seeing comments like this. ๐Ÿ˜‚

[-] blackluster117@possumpat.io 10 points 1 year ago

It's like watching a car crash in slow motion trying to read it. I can't look away...

[-] Mr_Reach@lemmy.world 9 points 1 year ago

I threw up in my mouth.

[-] Jax@kbin.social 7 points 1 year ago

I was going to suggest ALL CAPS in response, but then I remembered COBOL already exists.

[-] Stinkypete@lemmy.ml 6 points 1 year ago

I'm dumb . does the program do anything?

[-] Starry@lemmy.world 14 points 1 year ago
[-] quinkin@lemmy.world 5 points 1 year ago
this post was submitted on 25 Aug 2023
603 points (94.8% liked)

Programmer Humor

32426 readers
1035 users here now

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

Rules:

founded 5 years ago
MODERATORS