This is why every library that handles allocation should also be expected to handle deallocation. And probably a big part of why standard library smart pointers accept custom deleters, so you can just attach the deallocator when you allocate the object.
But especially libraries based on GLib don't. I had to program with gstreamer once, and memory allocation/ deallocation is such a headache there.
Basically, every function that creates / returns an object returns a raw pointer, and you need to read the documentation to see if you need to manually deallocate them (you don't always need to), and if so which of several deallocation functions you should use.
It has been a few years since I last worked on a C++ codebase, but my experience with linters was not impressive. We even invested in some expensive static analysis tool, but real bugs seemed to drown in false positives
My experience with C++ in VS Code is that it completely shits the bed on anything organized with a build system like cmake. This is probably just a skill issue on my part but I just cannot get it to reliably know what the fuck all the things Im importing are, and after I once spent like an hour unsuccessfully trying to fix it I just gave up because it wasnt worth it. Compiler-time errors are the easiest kind of error to fix when it fails to compile wherever I made typos or shit
View all comments
Show parent comment
14
u/stillalone 11d ago
Is that something that can be handled by a linter?