Over the last month and a half* one of the things I’ve been tasked with was removing memory leaks from our software. At first, it looked like as if I was presented with a daunting responsibility, with the VLD spewing several thousands of apparent memory leaks after just a sample test-run of our main program. Fortunately for me, the vast majority of the leaks seemed to originate from three interface classes.
Tag: C++
Another two interesting C and C++ quizzes
It’s been a while since I posted anything, so… here I am, still alive, doing science, and a little busy. That said, just a few hours ago I stumbled upon two interesting C and C++ quizzes and, despite my own score being rather poor, I’d like to share. Without further ado, links:
Proper C, improper C++
I have recently been asked if it’s possible to write a legit C program that wouldn’t compile in C++ mode. Obviously, my answer was positive, but the question made me wonder just how many incompatibilities there are between these languages, and how many of these I can cram into a single test case? I’ve decided to try my hand at writing such test case, and after a while of research I ended up with a fairly decent attempt.
A few interesting C quizzes
I’ve stumbled upon some interesting C knowledge quizzes. They deal with subset of C that is almost completely compatible with C++ (except for headers), so they’re also valid for that language. There is no doubt that a major part of these questions is just bad programming, even if correct from the standard’s point of view, but I still felt good about myself after getting full scores without cheating.
I think I should mention that for the second link, it is wise to assume that sizeof(int) == 4