Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Geoxion9014yThere are compiler flags to detect that and either display it as a warning or error.
Why this is still opt-in is beyond me... -
When i built the core of a game engine a few years back, i had exactly the same Problem. First thought some reference to the Engine Class was broken, because i used it across multiple Threads (well, thread safe ofcourse), but in the end it turned out, that the Threads all use a function to get the reference. That function returns the ref by signature, but in fact did not
and left me wondering, why the reference always crashed the thread.
Two days i was busy figuring out, what the cause was, until i found the missing return -
I've been putting off learning c++ and praying someone would create a better c# for this exact reason.
c/c++ create a lot of unmanaged errors that sometimes make 0 sense and multiply the more 3rd party stuff you add. -
YADU13894yThis won't compile if you have appropriate warnings turned on. I've been bitten by this problem exactly 0 times...
-
YADU13894y@Demolishun if you're working in a really old codebase, I'd recommend slowly adding warnings and errors for stuff like this to your project.
Obviously going to take some time but it's better than the alternative -
@YADU why does it seem like this is another what's that language called the gnome project never completed.... vala.
you know that its been long enough you'd think someone would create a decent translator for backending to the gnu compiler suite at the very least implementing common translations for different ways of handling the same problems in different languages and a nice optimizer that says 'oh this is a binary search, oh this is a sort, oh this is an index.... ok so we do that this way in this language' i'd love to see something like that that then backends to c/c++ and compiles straight off at high levels of optimization !
Related Rants
If you are programming in C++ please always return a type from a function as the function prototype return type.
I had to debug some old code that failed to return a boolean on one of its flow paths. It would work on linux in release and debug, would work on windows in debug, and fail on windows in release.
The failure was NOT straightforward at ALL. It would return exit code 3. Then if I added a debug print to the function it would segfault.
Why the hell would popping something extra off the return/call stack not crash more readily? Wth is the point of debug compile if it won't catch shit like this?
rant
return