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
-
Lensflare17287297d@AlgoRythm oh you remind me of yet another reason to never touch C++ again.
Too many traps. -
Hazarth9484297djust checking that you're using valgrind to investigate this and will never ever stop using it in the future
-
LotsOfCaffeine4281297dthe worst part about this is that the compiler won't give a shit about it, even if it can directly detect this.
Edit: clang-tidy has a warning for that, might be interesting (https://clang.llvm.org/extra/...) -
AlgoRythm50164297d@Hazarth I’m using smart pointers, lots of shared ownership too, will it work well in this case?
-
thebiochemic3012297d@Hazarth valgrind is super useful in general 👌
but definitely a must have for C++ -
Hazarth9484297d@AlgoRythm chances are it will at least notice something is wrong and warn you, giving you a rough idea where it happens. Even if smart pointers can be a bit harder to trace, valgrind has ways to help you. For example the heap profiler might come in handy to see which objects are being allocated a lot. It's one of the best tools for a c++ dev, hands down
-
AlgoRythm50164297d@Hazarth Yeah, I used the visual studio heap profiler and it's a really good diagnostic tool
-
shovethisrant5978297dOur prof used to beat us if we were caught with any memory leaks in our code
-
lorentz15126296dC++ allows you to customize your classes by picking individual answers to questions like:
- do you want polymorphism?
- should polymorphism actually work?
- should the subclasses leak? -
LotsOfCaffeine4281295d@lorentz oh I have a good one too: do you want schroedingers polymorphism? Then just implement the public virtual functions as private and see what happens!
-
lorentz15126295d@LotsOfCaffeine I can't fathom why this is legal. It has literally no legitimate use cases.
-
AlgoRythm50164295d@lorentz Well maybe the derived class is more modest than it's predecessors?? It won't just open up its virtual functions for any old object that asks?
-
LotsOfCaffeine4281289d
-
AlgoRythm50164289d@LotsOfCaffeine just added __PRETTY_FUNCTION__ to my list of things I know. Looks like it might me a gcc-only extension though.
Edit: in visual c++ __FUNCSIG__ -
LotsOfCaffeine4281289d@AlgoRythm yeah its gnu specific, though I think clang has something with a similar name
__FUNCTION__ is standard, though I think it stems from C and is only the functions name, not the return type, class, namespace, template arguments, etc
Related Rants
-
xjose97x19Just saw a variable in C named like this: long time_ago; //in a galaxy far away I laughed no stop.
-
Unskipp24So this happened last night... Gf: my favorite bra is not fitting me anymore Me: get a new one ? Gf: but it ...
-
sam966911Hats off to this lady .... I would have just flipped the machine
Lesson learned: if you're going to derive a class in c++, make sure to declare a virtual destructor on the base class!
I just fixed (one of...) the massive memory leaks in my damn project.
Pictured: the strings in a derived class actually getting freed!
rant
c++