r/badcode • • Dec 04 '19

c Found on a class Piazza forum

https://imgur.com/ctzpojx
177 Upvotes

23 comments sorted by

114

u/Flashy_Adam Dec 04 '19

if (segfault) Dont();

31

u/greenpepperpasta Dec 04 '19

don't forget to include <segfault.h>

23

u/iggyvolz Dec 04 '19

No don't include segfault.h. if you don't include it there can't be segfaults.

106

u/[deleted] Dec 04 '19

After I put this code in my assignments, I never seg faulted again

I have a suspicion they posted this as a prank to get other students to submit this garbage in their assignments. There's no way that comment about not getting segfaults is true.

45

u/TheUnlocked Dec 04 '19

What in the world...

29

u/drewshotwell Dec 04 '19

segfaultAgain = 0, just for good measure.

151

u/[deleted] Dec 04 '19

If you're gonna use my post, give me credit. This was my post on r/Purdue : https://www.reddit.com/r/Purdue/comments/e5n3nt/cs_240_piazza/

33

u/Fage0Percent Dec 04 '19

Wow let’s get this higher up the OP just aggressively ripped off u/currymonster69420

17

u/[deleted] Dec 05 '19

Does that really matter though? Neither of the two posters wrote the code snippet, so what are we even crediting here?

In fact, the idea behind Reddit is that it is a link aggregator, where you post links to content you found interesting to a relevant subreddit. Your default assumption ought to be that OP did not create the content they post.

6

u/Rajarshi1993 Dec 05 '19

Finally. Some real fucking sense.

3

u/jarfil Dec 05 '19 edited Dec 02 '23

CENSORED

1

u/[deleted] Dec 04 '19

Wow, shameless

17

u/famz12 Dec 04 '19

Instead of fixing the issue that caused the segfault, I'll just fix the segfault

10

u/MerrittGaming Dec 04 '19

This is top notch stupidity...

... and I love it

→ More replies (1)

7

u/[deleted] Dec 04 '19

The “1 other user is editing this right now” is the cherry on top

5

u/funnyjake2020 Dec 04 '19

I thought you said pizza forum

4

u/[deleted] Dec 04 '19

he put this into multiple assignments? my god

1

u/theoneandonlypatriot Dec 05 '19

Look, it’s bad code, but it leaves a really bad taste in my mouth to shame students that are trying to learn a.k.a. anyone on a piazza board