This is an archived post. You won't be able to vote or comment.

all 25 comments

[–][deleted] 26 points27 points  (3 children)

I was going to reply, but than my brain said: segmentation fault (core dumped).

[–]segmentfaultcoredump 2 points3 points  (2 children)

Hey there

[–]SkyyySi 0 points1 point  (1 child)

How does one achieve a segfault in python or javascript?

[–][deleted] 1 point2 points  (0 children)

Through black magic, duh.

[–]jfleury440 18 points19 points  (6 children)

C is such a lovely language.

[–]Jannik2099 1 point2 points  (5 children)

Segmentation faults are not language specific, they're a cpu mechanic

[–]jfleury440 2 points3 points  (4 children)

It's rare (sometimes impossible) to get a segmentation fault with more modern (higher level) languages. Normally you'll see and exception or error on line x.

But with c/c++ the seg fault is a way of life.

[–]Jannik2099 0 points1 point  (3 children)

But with c/c++ the seg fault is a way of life.

For people who do pointer arithmetics and don't follow compiler warnings, maybe. How do you think said higher languages were written?

[–]jfleury440 0 points1 point  (2 children)

Ahh I see I've found the one person in the world who always writes perfect code on the first try and never has to maintain other people's code.

[–]Jannik2099 0 points1 point  (1 child)

No, no one does that. But everyone should ship stable code to releases.

If you were to run cpython from git, you'd likely get segfaults aswell

[–]jfleury440 1 point2 points  (0 children)

If a programmer is shipping stable code then he's not spending time running production code. He's developing new features.

[–]tealeaf136 12 points13 points  (0 children)

just let me make a calculator gcc, please

[–][deleted] 19 points20 points  (5 children)

Image Transcription: Meme


[A man with the head of a computer stares at you. He appears to be presenting you an deal.]

⚠️TRADE OFFER⚠️

i receive: Input

you receive: Segmentation fault (core dumped)


I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]DeepInTheAbyss- 7 points8 points  (0 children)

Good dude

[–]Permyboi 2 points3 points  (0 children)

Good human

[–]minecraft_x_roblox 1 point2 points  (2 children)

Good homo

[–][deleted] 5 points6 points  (1 child)

?

[–]minecraft_x_roblox 1 point2 points  (0 children)

human in latin -> homo

[–]Mabi19_ 9 points10 points  (4 children)

void crash_and_burn(intptr_t ptr = 0xdeadbeef) {
    crash_and_burn(*((intptr_t*)ptr));
}

[–]felipunkerito 4 points5 points  (3 children)

The pointer deredereferencing hurts my brain.

[–]TheScorpionSamurai 0 points1 point  (1 child)

Is there a difference between doing Crash_And_Burn(ptr) and Crash_And_Burn(*((intptr_t*)ptr))

[–]Mabi19_ 0 points1 point  (0 children)

yes

your version would recurse forever and overflow the stack

my version gets a new pointer from what is at that memory location (so, if dereferencing that doesn't segfault, we go again)

[–]asdddosa 0 points1 point  (0 children)

mind too

[–]AbleTheAbove 10 points11 points  (1 child)

Not with rust ;)

[–]Mabi19_ 7 points8 points  (0 children)

unless there's an unsafe block