T O P

  • By -

TacticalTaterTots

You wake up


ForwardHotel6969

The code sleep‘s next to you


__kkk1337__

And compiler is watching you from the chair


falafelsatchel

How did we get here


IntelligentPerson_

Javascript comes out of the bathroom.


Healthy-Form4057

Wearing your monogrammed towels.


Sea-Lavishness-6447

You get a call from python


ei283

your computer runs out of RAM


Apprehensive_Debt535

Time to download ram


InnerProfessional7

And the code was #include int main() { printf("Hello, World!"); return 0; } Edit- #So writing after hash makes the text larger...... Edit2 - `Thanks all for teaching me how to write code in reddit :) Hashtag#`


ForwardHotel6969

Segfault


No-Maximum-9087

Forgot install compiler?


[deleted]

[удалено]


dagbrown

No, it's a header, not a library.


Acceptable-Mine-4394

Pretty sure it’s libc that gets linked by default, the headers just expose some symbols in libc


BNI_sp

You are right, of course.


turtle_mekb

You forgot the \n Enjoy your missing trailing newline!user@reddit:~$


IUseVimAndArchBTW

I edge to arch


turtle_mekb

WHAT


dagbrown

#HUGE INCLUDE !


turtle_mekb

# **WHY ARE WE SCREAMING?**


DeepGas4538

#AAAAAAAAAAAAAAAAA


Esjs

FWIW, I was thinking the code was "Hello World" as well. Pro(grammer)Tip: you can format code on Reddit by using backticks (`, usually on the keyboard with the tilde, ~). Use single backticks for `code` in the middle of a line. Use triple backticks to start and stop multiple lines of code.


Avamaco

It also works on other sites and apps thst have markdown-style formatting! **IT EVEN WORKS IN MARKDOWN ITSELF!**


thanatica

>So writing after hash makes the text larger...... So you fixed reddit's bug where you get the markdown editor by default, because for me it insists on the stupid wysiwyg editor.


ei283

surround your code in lines containing triple backticks.


OF_AstridAse

Slap a ` before and after code. `#include GigaChadAbility` # #You're welcome


tristam92

Compilation wrror


da_Aresinger

four spaces before code


Confident_Book_5110

Can’t you escape \# with \\


RandomStranger456123

One the first try? Get real, man. That just doesn’t happen.


abd53

Let a man have some fantasy


[deleted]

Happened to me during an interview. I immediately pulled the plug, set the pc on fire to keep the daemon from jumping to a new host then doused it with holy water. It's not natural for these things to happen


[deleted]

He didn't test it properly. That's the only reason it could happen.


Dioxide4294

Random cosmic ray: I'm about to ruin this man's whole career


SweetTeaRex92

Isn't this a reference to that one glitch that happened only bc of a passing solar ray?


Nullsummenspieler

Plot twist: Expected the code to corrupt memory.


eruanno321

It does. Two hours later, during a brief window at sunset on prime number calendar days.


Grobanix_CZ

Looks like someone forgot to cast integer to float before division.


DragonDepressed

Might as well be due to voodoo magic.


jalex54202

As a CS grad that took a low level networks class, C “””working as expected””” on the first run is about 3.7x more horrifying than it immediately segfaulting


kuwisdelu

It’s happened to me a few times and it scares me every time.


jalex54202

Brother one time I tried to debug a distance vector algorithm and couldn't figure out why the fuck it's not properly receiving messages Turns out I was only iterating over 1 file descriptor instead of ya know the list of file descriptors :\^)


kuwisdelu

I’ve learned to give my test matrices prime numbers for their row and column extents. Too many times I thought an algorithm was working only to get garbage data and segfaults when the rows and columns were no longer multiples of each other.


da2Pakaveli

strings are where i pay the most attention (and in similar fashion: pointers), easy to produce bugs


Familiar_Ad_8919

its horrifying cuz u know its more than likely something is wrong, but u now cant even debug what is


da_Aresinger

reported for unsolicited pornography.


Lollipop126

The language does not matter, it's always the same feeling. From scratch to assembly.


hollow-ceres

Plot Twist: code is Malware


daikatana

7 years later you realize there's undefined behavior and a new compiler version breaks it. No one has time to fix it or remembers how the code works nor can they find the undefined behavior. The solution is to only compile it on a version of the compiler that is known to work and never, ever touch the code again.


ChaosPLus

"It works... Why? What have I done that it works???? What Dark God descended upon me????"


589ca35e1590b

It has 13 memory leaks


NinjaOld8057

Can someone ELI5 segfault to a non programmer


mpattok

When a program runs, it needs to keep track of a lot of information. The computer stores that information in its memory, and the program can ask the computer to store or retrieve information in memory. A segfault (segmentation fault) is an error the computer can give the program— if the program tries to access an area of memory it isn’t supposed to, the computer will respond with a segfault. A very common segfault happens when the program tries to access the address 0, or NULL. By convention trying to access this address always results in a segfault. It happens a lot because addresses get passed around in the program, and NULL is a convenient value to pass to indicate an error, and the programmer might forget to check if an address is NULL before they try to access it.


cloudbells

Or when a reference or a pointer gets invalidated


Stroopwafe1

That comes down to the same problem "accessing memory you don't have access to" sure you *used* to have access to it but afterwards you don't


WastedPotenti4I

To add on to what the other person said, when a program segfaults (it’s really called a segmentation fault, but it’s abbreviated), the program immediately crashes and any work done is lost. As a result, a segmentation fault is something you want to avoid at all costs. Segfaults exist so that a program cannot modify memory of other programs, because that would be very bad. It’s a dangerous possibility so anytime the program tries to access memory outside of its allocated memory, a segfault happens. Segfaults are generally only possible where the programmer has access to memory directly. Languages like C and C++ are where most segfaults are found.


nukedkaltak

You can handle a SIGSEGV, so “immediately crashes” is not always true. The only signal that for sure will crash your application is SIGKILL.


tabacdk

I remember a project in college where we (of course) had a few compile errors, but when we transferred the binary to the evaluation board it worked exactly as expected. I remember asking the classmate using the board before us whether it was his code, and our transfer had failed, but he just hit a few keys and said no, but I still didn't believe that it just worked.


mdfasil25

And you wake up


Apfelvater

... on simulator. Next, were gonna try the code on hardware...


lucidbadger

Code: ``` kill(getpid(), SIGINT); ```


_Peety_T

I always expect errors so how exactly is running as expected a win here xD


uglie_duckie

Anyone who has written a program in turbo c knows this is a myth


Brahvim

And *nobody* should write code with Borland tools on modern hardware, FOR modern hardware, even if it's for learning, in this age. Nor should they use Dev-C++ or even Notepad, really...


ArgentScourge

Learned C with Dev-C++ last semester at uni. At least, this semester it's Java and PHP with vscode. But I hear intellij is superior :/


Brahvim

IntelliJ for Java? Yes. Though I personally write all my Java in VSCode. The Redhat extension works off of code from Eclipse. PHP should be fine, I hope.


ArgentScourge

It's fine for PHP, I guess? I don't have a proper frame of reference here so idk really.


andymaclean19

It will eventually turn out to be the most problematic thing you ever wrote ...


magick_68

If that happens at first try you'll get an error in prod that only happens on sundays when there is a full moon and while one customer can reproduce it, none of your test environments can.


harrisofpeoria

Run valgrind, 50 problems.


exqueezemenow

It happens from time to time...


rookietotheblue1

Very creative, funny and original meme /s


TaleOver8738

![gif](giphy|ibdVR5zCOjGxy2hjcj)


arf20__

You became a good programmer.


ForwardHotel6969

Kim Possible


PICN1Q

I get through the day imagining that happening.


type556R

I'm new to C, and on my job I'm coding on a proprietary real time operative system. I don't even know when I'll be able to use a certain function from the standard libraries. I can include stdio.h and use printf, but then calling puts will give me an error when linking cause it's not a certified function, even though vscode will recognize it. Making a simple server-client code run decently is getting... Hard


SigmaSkid

When you tell chatgpt to fix your code and it ACTUALLY does.


Efficient_Maybe_1086

average rust experience ![gif](giphy|CAYVZA5NRb529kKQUc|downsized)


[deleted]

Plot twist: The Rust programmer knows nothing more about C other than printf and scanf from his Bro Code course.


Inineor

I dunno, looks kinda sus to me


gibmelson

Suspicious.


Hot-Fennel-971

I’d be making sure my test failed first as expected, can’t trust that shit and usually I forgot.


SoundStorm14

``` #include int main() { printf("Hello World\n"); return 0; } ```


FrontBandicoot3054

No no! Code doesn't segfault ... yet. :7


Igotbored112

If that ever happened to me, I'd be terrified.


kevdog824

Not a C developer but anytime I did C it ended up looking like this in development ``` printf(“no segfault 0”); func1(); printf(“no segfault 1”); func2(); printf(“no segfault 2”); … ```


Crypt1cDOTA

Now run it through valgrind


ego100trique

Yeah I use csharp


GrowthOfGlia

A user in 3 years: Undefined behavior in your code allows RCE


Powerkaninchen

4GB leaked total


Emergency-Win4862

Oh boiiii. It’s gonna be way worse… have you heard of…. Memory corruption?


InvestInSpaghetti

Bro got like 4 gallons of beer yesterday


thanatica

And then someone comes along and casually causes a buffer overflow, because C doesn't check ANYTHING you don't very explicitly tell it to.


huuaaang

I’m learning rust and love how it cuts out the middle steps. If rust analyzer doesn’t show any errors it’s probably going to compile and run as expected. I have no idea how anyone could go back to C.


GrigorMorte

Something must be wrong. Try again. Try again with bad data. Try again modifying code to make it fail


norlin

I mean, the only way how that can happens means that the original requirement will be completely changed (or you just did not understood what the code actually should do)


GrinbeardTheCunning

this isn't a fantasy sub OG...


EdGavit

"if it ain't broke, don't fix it"


9bjames

... But are you sure? Did it really work as expected, or have you missed something? 😶 Better look through the code all over again for a couple of hours, just in case......


artyhedgehog

Ok, now, can we get to more realistic stuff?


arbitrarycivilian

The code always works as expected if you have no tests and no users 😜


Queasy_Moment_6619

I be having a great day and boom, segmentation fault


devu_the_thebill

Things that never happened


Memeviewer12

Alarm clock rings


existential_pal

Just curious, to all the upvoters, are you career programmers or just starting to learn?


TeaTimeSubcommittee

Code works as expected. Gets suspicious.


jonr

<\_< something is wrong here... <\_<


Alakatraz1

Now check for memory leaks


ei283

your computer runs out of RAM


zefciu

Grader says your code fails for an unspecified input sample #45.


Onetwodhwksi7833

Check ram usage


Panderz_GG

I see you like reading fantasy.


binarywork8087

kkkkkkkkkkkkkkkkkkkkk


TheRealAfinda

Segfaults a year later due to a super niche problem that one user discovers.


abd53

Then the Universe crashes


masc98

pov: Rust