Spent a day debugging vprintf because I didn't know __LINE__ was an integer and not a string. Someone just kill me!
C and C++ seem to have way too many of these blackholes that will suck your time than other high level languages. Even chatgpt goes pathological at times.
TIL in c++ all of these below are valid and the first 2 mean the same type while the rest are different types.
const int **
int const **
int * const *
int ** const
Tried to upgrade my lunar ubuntu to mantic. Both are EOL. Nearly hosed my work laptop. Thought my harddisk had crashed but it was just a corrupt efi. Half a day but I am on mantic now. Tomorrow we try the next step noble.
Back to writing C++ and C and the old problems still remain
1. impenetrable errors
2. needs in-depth knowledge of build system
The only good thing now is that instead of scrolling through millions of stackoverflow posts you can just ask chatgpt but it will only take you so far.
Thoughts on working on a project that spans Golang and C:
GC vs roll your own allocation is such a problem.
Memory-leaks, crashes galore.
I would prefer IPC (socket, pipe) over cGo anyday!
Performant, production-ready C code is another level of complicated.
On Linux if you open a lot of files but read them only once, there is a good chance that the files are getting cached even though you don't need them anymore.
This command
echo 2 > /proc/sys/vm/drop_caches
drops all cached inodes, dir entries etc.