Tag Archives: stackoverflow
What it takes to run Stack Overflow
Today What it takes to run Stack Overflow popped up on r/programming. It’s an old article (2013) but still interesting. It referenced Performance is a Feature and made the bold-font claim that “the cost of inefficient code can be higher than you think.”
The difference between delete and delete[] in C++
I just learned about the difference between delete and delete[] in C++ by reading this article from StackOverflow. Basically you use delete[] to delete arrays, and delete for everything else. There was conflicting information about whether C++ runs the destructors on objects in an array when the array is deleted. Some people said it did, others said it didn’t. I should do an experiment to see one day. The reason for the difference between delete and delete[] seems to be that when C++ allocates an array it allocates memory for storing the size of the array as well as the array elements, and then returns a pointer to the first array element, which is beyond the start of the allocated memory, because the array size takes up the first bit of space.