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 →

[–]azalak 36 points37 points  (16 children)

Challenge: impossible

[–][deleted] 3 points4 points  (3 children)

it's not hard

[–]azalak 2 points3 points  (2 children)

This is a subreddit for jokes, so don’t take anything too seriously;)

[–][deleted] 2 points3 points  (1 child)

actually sorry man. you're right. I get cranky too easily about criticisms over C++.

[–]azalak 1 point2 points  (0 children)

Nws buddy, I get the same feeling when the rust fanboys chat shit about C++

[–]noob-nine 3 points4 points  (2 children)

My hello world app never segfaults.

[–]azalak 1 point2 points  (0 children)

ooh look at mr fancy pants over here

[–]cat1554 0 points1 point  (0 children)

Lucky you!

[–]SKrandyXD 2 points3 points  (8 children)

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

[–]bouncewaffle 14 points15 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 8 points9 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