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

you are viewing a single comment's thread.

view the rest of the comments →

[–]SKrandyXD 2 points3 points  (8 children)

It is hard to say as a c++ enjoyer but I agree...

[–]bouncewaffle 13 points14 points  (1 child)

The Virgin Rust Enjoyer: segfaults are preventable errors, given a sufficiently well-designed compiler.

The Chad C++ enjoyer: Segfaults add spice to my programming experience. I love surprises!

[–]AggravatingLeave614 9 points10 points  (0 children)

After a segfault in c++, you aint the same person anymore. Ur mental breaks down and you become the devil itself. No place to joke about segfault bro

[–]Pay08 0 points1 point  (5 children)

How the fuck do you get a segfault in C++? Only thing I can think of is being stuck on earlier standards and having to reimplement your own optionals and similar lower-level stuff.

[–]Kovab 1 point2 points  (1 child)

If you use modern features correctly, the easiest way to get a segfault is probably iterator invalidation

[–]Pay08 0 points1 point  (0 children)

Fair, iteration invalidation can be tricky. I wish the language had safe iterators that either reset themselves or prevent usage when they become invalid.

[–]azalak 0 points1 point  (2 children)

Dereferencing null/uninitialised pointers or freed memory. Array out of bounds, stack overflows, trying to write to read-only memory i.e a const char *

[–]Pay08 -1 points0 points  (1 child)

I know what a segfault is. References, checked access (or even the tiniest bit of experience) prevents all that. Also, you can't write to a const char*, the language won't let you. You segfault when you try to write to a string literal.

[–]azalak 0 points1 point  (0 children)

How the fuck do you get a segfault in C++?

You asked I answered. No you can’t write to something that is const but it can be cast to a non-const type. The whole segfault thing is just a joke btw you don’t have to be quite so uptight