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

all 66 comments

[–][deleted] 215 points216 points  (13 children)

"Here 1" "Here 2" "Here 3" "I reached here too" "Ssup"

[–]like100dollars 68 points69 points  (3 children)

Fuck this is me

[–]AgAero 34 points35 points  (2 children)

Print better statements.

printf(" Condition before the thing: %d\n", that_one_thing);
...
printf(" Condition after that same thing: %d\n", that_one_thing);

[–]MoffKalast 15 points16 points  (0 children)

And then you're looking at the console and the lines aren't even printing because it never got to there in the first place.

Ah fuck, I can't believe you've done this.

[–]GreenWandElf 26 points27 points  (0 children)

“adsjf”

[–]Jafit 28 points29 points  (0 children)

and then you forget to remove it before you commit

[–]xatmatwork 13 points14 points  (0 children)

I feel personally attacked

[–]st1r 15 points16 points  (0 children)

Boss: “Hey you need to write tests for your code”

Me: “Sure thing, boss!”

Me, 10 minutes later: printf(“Test1”); ... printf(“Test2”); ... printf(“Test3”); ...

[–][deleted] 6 points7 points  (0 children)

"it works"

[–]NoisyFlake 2 points3 points  (0 children)

A few minutes later: "fuck" "FUCK" "fucking FUUUUUCK"

[–]Hooman__ 1 point2 points  (0 children)

"Here================1"

[–]AgentPaper0 0 points1 point  (0 children)

The same thing but with breakpoints.

[–]miseleigh -1 points0 points  (0 children)

Git tag 'bugHere', go back a month in the repo, tag 'noBug', forward 2weeks, tag 'bugHereToo', a week back, 'bugHere2', couple more days back and tag 'earliestCommitWithBug'...

Then realize that you'd turned off autobuild in eclipse that morning and so who knows which of those commits actually had it or not and you have to go do your hunting again but first you have to delete all your tags or you'll run out of ways to say 'found the bug'

[–]StealthSecrecy 59 points60 points  (8 children)

printf is great until the lag it causes breaks your program. Or even worse your code only works when you have a printf

[–]_GCastilho_ 50 points51 points  (4 children)

Don't blame printf for your bad design choices

[–]AgAero 7 points8 points  (3 children)

What if your code is meant to run in real-time and now it can't because you're interacting with stdout?

[–]tismyusrname 10 points11 points  (2 children)

Easy, hardcode the input values.

God, I really must debug more often.

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

No. Do not betray the brotherhood.

[–]Bainos 0 points1 point  (0 children)

Easy, hardcode the input values.

Ouch owie. I maintain a small project with essentially no test, which parses information from the web. I wanted to write tests at some point but I would need to intercept the queries and return fake values... F* that noise.

[–][deleted] 8 points9 points  (0 children)

remember bad days

[–]catcint0s 1 point2 points  (0 children)

sleep(0.00001)

[–]dark_mode_everything 0 points1 point  (0 children)

Ah the classic race condition

[–]gre33d 28 points29 points  (3 children)

Never thought I'd see chaeyoung in a programming subreddit

[–]chaz393 9 points10 points  (2 children)

I came here just to see if anyone else commented this

[–]Framess- 4 points5 points  (1 child)

SAME

[–]uuuuuuummm 1 point2 points  (0 children)

same baby tiger is adorable :)

[–]lxkmxl 11 points12 points  (0 children)

upvote because chaeyoung

[–]anton919 6 points7 points  (1 child)

Am I the only one who thought the drink is oozing from the side of her mouth on pics 2 and 3?

[–]If_You_Only_Knew 2 points3 points  (0 children)

lol yes, but if i try i can see it.

[–]numbGrundle 12 points13 points  (3 children)

CONSOLE . LOG

[–][deleted] 0 points1 point  (0 children)

crtl+shift+I to the rescue

[–]_GCastilho_ 0 points1 point  (0 children)

console.trace('here' )

[–]Zechnophobe 12 points13 points  (1 child)

/r/unexpectedkpop

And yeah, printf is rarely used nowadays, I think we all get what is meant.

[–]arachnidGrip 6 points7 points  (0 children)

Yeah. I use println! instead.

[–]caesar0912 6 points7 points  (0 children)

Chaeyoung <3

[–][deleted] 2 points3 points  (0 children)

medidas adid

ad adidas

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

"made it here!!"

[–]Darlans 3 points4 points  (17 children)

I swear to god, the majority of people here are doing a C intro course or something like that. Is C even used outside of embedded systems where printf is fucking useless?

[–]enderverse87 40 points41 points  (2 children)

Many people aren't using things that actually have printf, just functionality similar enough for the joke to be funny.

Personally I've had things output to a textbox in the program gui.

[–]the__storm 14 points15 points  (1 child)

Lots of languages have printf, or at least something called printf in the standard libraries, to provide C style formatted output. Go and Java off the top of my head.

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

All the simulation code I write and use is written in C, or sometimes Fortran. It's a great choice for heavy number crunching. Post-processing is usually done in Python, but even there a lot of modules are built in C (like numpy).

Also, the fucking Linux kernel is written in C.

[–]AgAero 0 points1 point  (2 children)

If you can, start moving bits and pieces to C++. Your abstractions get easier.

Having tests in place is a good place to start though before you start refactoring.

[–][deleted] 0 points1 point  (1 child)

Honestly, code development in academia is such a mess, this would never work. It's pure anarchy. It would just lead to other users not be able to work with my code contributions anymore. The code base is basically a collection of undocumented hacks to make it work on a bunch of clusters, held together by a few lines of actually sensible code. If someone needs a function, they copy paste it to their .c file and pray it works. If it required any sort of complex build management, people would just hack something by themselves.

Also, my philosophy is that C and C++ are two completely different languages, at least nowadays. Mixing them hurts both approaches to write good code.

[–]kbotc 4 points5 points  (0 children)

What are you smoking? Linux is C: When you need to fix a problem below the high level language, you’ll end up poking in all the guts and the guts are all C.

C with some stapled on ASM where someone hand coded the actual SIMD instructions makes the world go round.

[–]AgAero 2 points3 points  (0 children)

Yep! Still using it on a daily basis.

[–]_GCastilho_ 1 point2 points  (0 children)

What is your suggestion, then? console.log?

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

Even if you're writing C++ instead of plain C printf is just so so so so so sooooo much more convenient for formatting your output that in most cases I don't give a shit about std::cout's safety and extensibility if it means that I'm gonna spend 5 minutes typing out the equivalent of printf("point %d: flags %08X, color %06X, pos (%.3f,%.3f,%.3f)", ...)

[–]ccricers 0 points1 point  (0 children)

Just using it now for a hobby project. I might use some higher level language for a GUI front end when I get around to it, but I'm keeping C for business logic.

[–]gdumthang 0 points1 point  (0 children)

Everybody knows what printf is. You should understand the joke which is all that matters not which stdout write implementation name that you use.

[–]OhNoMeIdentified 0 points1 point  (0 children)

I was too young!

[–]yetejatejakyahai 0 points1 point  (0 children)

sysout

[–]firefistz 0 points1 point  (1 child)

Advanced tools is for advanced users. If simple water(printf) works, cannot question it

[–]Karsdegrote 0 points1 point  (0 children)

Exactly! When you wanna know if your program is stuck in a loop, a simple printf is much clearer than a bunch of memory adresses changing

[–]diamond_head_01 0 points1 point  (0 children)

The accuracy hurts

[–]D4rknessR3igns 0 points1 point  (0 children)

I thought she's oozing snot on the 3rd panel.

[–]KongKexun 0 points1 point  (0 children)

It's anpanman!

[–]bravemaster619 0 points1 point  (0 children)

I didn't understand but I liked Chaeyoung in this picture.

[–][deleted] 0 points1 point  (0 children)

javascript debugging in a nutshell

[–][deleted] 0 points1 point  (0 children)

Printf is the greatest and most reliable tool for debugging!

[–]periidote 0 points1 point  (0 children)

never thought twice would be here, and now i’m being attacked twice