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.
Category Archives: Programming
Pcdedupe
I’m working on a new ProgClub project called pcdedupe. It’s a file system de-duplicator and it’s a C++ system based on rdfind. I haven’t created the project page on the wiki yet, but the source code is available.
Basically I’m going to take a new angle on the rdfind software and tailor it to suit my particular environment (I have ten million files with massive duplication and rdfind isn’t optimised for that kind of scale).
Windows SDK 7.1
I followed these instructions from Mozilla to download the latest version of the Windows SDK which is installing as we speak. I didn’t install the .NET Framework Version 4, I hope that doesn’t create a problem for me.
Boost C++ library
I’ve downloaded the Boost C++ library and my little adventure with it will begin as soon as the files have copied.
dirent.h
I’m doing some Linux C++ programming, and I’m doing the dev work on Windows, so I figured I’d have a go at compiling in Visual Studio (I’m running VS2008). One problem I had was that there was no dirent.h header file, but I found one.
Making Subversion/SVN recognize CVS Id and Revision tags
Today I found this article Making Subversion/SVN recognize CVS Id and Revision tags which describes how to add support for Id and Revision tags in Subversion.
PHP krsort
Today I used the PHP function krsort for the first time. It sorts the array with keys in reverse order, which is exactly what I needed to get my version listbox options in order from latest to earliest.
Doctrine Bidirectional Mant-To-Many Associations
I found out how to do a Many-To-Many, Bidirectional mapping with Doctrine in PHP.
PHP in_array and array_keys
The PHP function in_array is a really handy way to check if a value is in an array. Combine with array_keys to check if a value is in the array keys.
The importance of !important in CSS
I found an article on !important which explains how !important works in CSS.