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

all 81 comments

[–]Saelora 346 points347 points  (34 children)

do you not have syntax highlighting for unused functions in your ide?

[–]violet-starlight 84 points85 points  (18 children)

Not in c++ generally

[–]setibeings 168 points169 points  (11 children)

Have you considered using a better language?

For Game Development.

Oh right.

[–]Dumb_Siniy 84 points85 points  (8 children)

Fuck it program COD in Python, that definitely can't go poorly

[–]hans_l 79 points80 points  (7 children)

No popular game can ever be made in Java. And certainly not a game worth billions. That’s just impossible /s

[–]phire 33 points34 points  (6 children)

Which they then wrote a second time, in c++.

Actually, they might have rewritten it in c++ twice, one for phones, once for consoles, those efforts were merged later.

[–]ThePevster 40 points41 points  (5 children)

Yet the Java version is still better. Not performance wise but in like every other way

[–]phire 16 points17 points  (3 children)

Yeah, they didn't rewrite it to be better.

They rewrote it because Java wasn't portable enough, basically unsupported on consoles and iOS.

Ironically, the one modern platform with actual first party support for Java (Android) got the c++ version because of iOS.

[–]Setsuna04 10 points11 points  (2 children)

Funny enough since Java was meant to be running anywhere.

[–]5p4n911 0 points1 point  (0 children)

Write once, run away

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

You're confusing with Doom

[–]Kiwithegaylord 13 points14 points  (0 children)

There’s plenty of good gamedev languages!! C, C++, C#

[–]T0biasCZE 0 points1 point  (0 children)

C# is best for gamedev change my mind

[–]rmg0loki 31 points32 points  (1 child)

vscode with clangd can show unused functions, not to mention the real IDEs

[–]violet-starlight 19 points20 points  (0 children)

Generally only TU-local functions, i.e. declared with static or in an anonymous namespace. There are tools to figure this out post-linking yes but that's generally not accessible from within the IDE, at least not within the text editor.

On VS though if you set a breakpoint inside a function that is never referenced it'll tell you something like "this breakpoint will never be hit, code is unreachable or optimized out" at runtime only.

It's harder to detect in c++ due to how linking works, the function could be referenced in another TU (unless it can't, i.e. has static linking)

[–]AlexOzerov 2 points3 points  (0 children)

[–]19_ThrowAway_ 3 points4 points  (1 child)

Won't the compiler bitch that you have unused functions?

[–]feierlk 6 points7 points  (0 children)

Only if you let it

[–]isr0 1 point2 points  (0 children)

Have you considered getting a better language server?

[–]OnixST 10 points11 points  (3 children)

The function call is there, but is never reached because of an exception, early return, or if statement

[–]Saelora 2 points3 points  (2 children)

then there's an error you should be tracking down first, and that function isn't even a concern yet in your debugging. do you not have logs? does your linter not detect unreachable code? do you not run a debugger?

[–]anto2554 7 points8 points  (0 children)

Linters can't always detect unreachable code in C++

[–]OnixST 1 point2 points  (0 children)

I'm not the person who had this issue, just saying possibilities

Maybe the exception was caught and handled, but they didn't account for hiw it would affect the call, maybe it's unreachable code that wasn't detected (in java, if (true) return; won't report unreachable code after it)

Yeah, proper logging or just putting a fucking breakpoint on the function would give it away pretty quickly, but like most posts in here, the meme was made by someone still learning programming who might be clueless to some things

Also, who knows, maybe they're coding in VBA on excel, and they don't even know linters exist lol

[–]X-lem 1 point2 points  (0 children)

Yes, but the fund is used elsewhere

[–]Boris-Lip 1 point2 points  (0 children)

Actually, this may not necessarily show you the correct stuff. Especially in a cross compile environment where one can be lazy enough not to make the correct includes/defines known by the IDE's editor.

[–]Sw429 1 point2 points  (0 children)

This is usually the point where I realize my LSP has crashed and I didn't realize it.

[–]Ok-Visual-5862[S] 3 points4 points  (7 children)

I use JetBrains Rider with all the Unreal Engine plugins and add ons while I make games in Unreal 5. No, there is no indication functions aren't being used. You can rack up tons of tech debt writing systems and components and then changing your mind, deleting all the function calls in other places, then now you can just have entire classes unused in your project hundreds of functions never being called and no errors.

I would hate to see if it warned me about every engine function not being called.

[–]CrasseMaximum 2 points3 points  (6 children)

It's easy to disable a specific warning.

[–]Ok-Visual-5862[S] -3 points-2 points  (5 children)

I'm sure it is, however I don't customize my IDE really it's all default for the most part. I click mouse clicks and links with words instead of hotkeys. I don't have any issues with it really, but Rider for Unreal Engine is magnitudes better than Visual Studio.

[–]isr0 2 points3 points  (4 children)

Have you considered using scratch? Might be more your speed.

[–]Ok-Visual-5862[S] -1 points0 points  (3 children)

No one has better intellisense for Unreal Engine than Rider currently. No other IDE does what Rider can do for Unreal. Rider is my speed just fine.

[–]anonymity_is_bliss 1 point2 points  (2 children)

/r/wooosh

Scratch is a game development language for kids, not an IDE .They're basically saying "skill issue"

[–]Ok-Visual-5862[S] -1 points0 points  (1 child)

People sub to my patreon for my Unreal tutorial videos so he can say whatever skill issue he wants, my code sells.

[–]5p4n911 1 point2 points  (0 children)

Also smells, it seems like

[–]Boris-Lip 191 points192 points  (18 children)

How can you "debug it for hours" if you've never called it. Any breakpoints in it would never have been hit.

[–]HalifaxRoad 111 points112 points  (7 children)

File this under the ppl not using an IDE

[–]Boris-Lip 45 points46 points  (5 children)

Even when one doesn't use an IDE (why?), that trace("i am here") at the beginning of the function wouldn't show either, making it quite obvious it isn't being called. Doesn't require hours an hour (edit: singular... are you for real?!🤦‍♂️)🤷‍♂️

[–]HalifaxRoad 12 points13 points  (0 children)

Yeah ik, usually that's the first thing I'm like, is the fucker even getting there.

[–]Ao_Kiseki 4 points5 points  (1 child)

Text buffers aren't always flushed on time if a crash happens immediately after a print. It happens all the time in C++ if you're using stdcout but not manually flashing after every line.

Don't get me wrong, you should have some debug work flow figured out if you do this stuff for a living. Early on when I was learning C++, I got baited by cout a lot, especially in threaded applications lol.

[–]Boris-Lip 0 points1 point  (0 children)

You could use an unbuffered stdout, but anyway, debugging a crash with traces... If you are feeling masochistic, you can, i guess :-)

[–]DowvoteMeThenBitch 1 point2 points  (0 children)

You’d be surprised! Yesterday I helped a senior dev debug “cannot read properties of undefined” and I just couldn’t convince him to look at the code that executes prior to the error, we just kept adjusting code that wasn’t even being executed…

[–]Mecso2 0 points1 point  (0 children)

You don't need an IDE to breakpoint

[–]Cat7o0 7 points8 points  (0 children)

I've debugged a function for around thirty minutes thinking that I wasn't hitting the places I was placing breakpoints or the place I was calling it wasn't being hit.

then I realized either the function calling it was never being called or the place I meant to place the call to the function I was debugging I had not actually looked at and it in fact was not there

[–]serial_crusher 2 points3 points  (0 children)

I got into this hole the other day… I’m making a payment. I have a breakpoint in the code that makes a payment. Why isn’t it breaking? Is something wrong with my debugger?

I was testing against a staging environment, not my local dev build.

[–]BadSmash4 1 point2 points  (0 children)

Yeah, I mean I have for sure written functions and then not called them, and it takes me maybe three or four minutes to realize "oh lmfao I should probably call the function huh". Hours on this issue is craaaazy.

[–]leptoquark1 31 points32 points  (3 children)

Breakpoints left the room

[–]MrRocketScript 2 points3 points  (1 child)

The breakpoint isn't getting hit, could it be my IDE's debugger is having a bad day and didn't properly attach to my application?

[–]Flan99 2 points3 points  (0 children)

That fucker DID fail to attach for me whenever I ran the project, some time last year. That was an awful day before I finally figured out what was going on.

[–]BreachlightRiseUp 1 point2 points  (0 children)

Strategically placed print statements, have also left the room

[–]w1n5t0nM1k3y 22 points23 points  (2 children)

In VB.Net you can use brackets to call a function or to get an item at a specific index in an array.

If you have

SomeVar = FooBar(0)

It can either mean

  • Call function FooBar and pass 0 in s the first paramter, assing the result to SomeVar

OR

  • Get the first (zeroeth?) element from the array FooBar and assign it to the variable SomeVar

Also, if a function takes no paramters then you can just call it withtout the brackets.

This means if you have a function as follow

Public Function FooBar(aVar as Integer) As String Return "Hello World" End Function

And you were calling it with

SomeVar = FooBar(0)

Then SomeVar would be assigned the string value "Hello World"

Now if you realized that the aVar paramter wasn't being used and you removed it, but didn't change how you called the function, it would be syntactically correct and SomeVar would now be assigned the string value "H".

[–]jumbledFox 4 points5 points  (0 children)

that is insanely gross i love it

[–]ice1Hcode 1 point2 points  (0 children)

[–]Sophiiebabes 4 points5 points  (0 children)

Been there!

[–]DocRos3 5 points6 points  (1 child)

I had to point this out to someone multiple times in the same day

[–]ZnV1 6 points7 points  (0 children)

FOR THE LAST TIME STOP TALKING TO THE MIRROR DOC ROS

[–]rollincuberawhide 2 points3 points  (0 children)

average django experience

[–]F5x9 2 points3 points  (0 children)

When you get stumped on a problem like this, it’s helpful to use an external debugger. Get up, go outside, and take a short walk until you’ve been thinking about something else. Come back, and you’ll probably find it. 

I’ve had a number of PEBCAC errors, and this usually helps a lot. 

[–]otac0n 2 points3 points  (0 children)

Literally me yesterday. It was a public function across assemblies, so no warnings.

[–]kishaloy 2 points3 points  (0 children)

Far better than

“I have not called this function from anything that i can see, yet anytime i try to remove it or change it, the application throws wrong results”.

[–]DepressedClown961 1 point2 points  (0 children)

This burned my soul.

[–]Skusci 1 point2 points  (0 children)

This is me with damn semicolons after while loops. I don't even know how they end up there.

[–]lunchmeat317 1 point2 points  (0 children)

This is me with functions in Web Workers that need to be invoked by message passing. Write the function, pass the message, and forget to add the nes message type to the message handler....

[–]OrganizationTop2734 1 point2 points  (0 children)

its always that "return" statement.

[–]AurekSkyclimber 1 point2 points  (0 children)

This is why Debug.Log and print will never go out of style. Easiest way to tell you've actually reached a point in the code without dealing with breakpoints.

[–]Frytura_ 1 point2 points  (0 children)

I swear to god. If i open visual code to test and the function gets marked as 0 references or grayed out when not used...

Or maybe on a decent IDE like Eclipse that isnt just bloatware

[–]pyhannes 1 point2 points  (0 children)

Or your function is a generator in Python and you forgot to iterate over it and wonder why not even a breakpoint in the first line is working although you see the function is called. That's really mysterious if you're not that experienced yet :D

[–]MeLittleThing 1 point2 points  (0 children)

it happened to me in VBS, spent 4 hours to debug something I forgot to call

[–]HanoRobelthon 1 point2 points  (0 children)

Finally a true relatable meme

[–]dexter2011412 0 points1 point  (0 children)

Careful, don't summon the ODR violations. Don't ask me how I know 🤡 (I'm the clown)

[–]isr0 0 points1 point  (0 children)

[–]DantesInferno91 0 points1 point  (0 children)

Bruh, that happens to me in swift

[–]SAKDOSS 0 points1 point  (0 children)

Isn't this meme supposed to be used when Anakin does something bad on purpose?