Tag: programming
The Identity of an Array
December 12, 2012 00:00
Given two arrays of integers: a and b, what does (a == b) mean?
Most of us will say, it depends on the programming language you are using, and that is true. In the case of C, it means a and b are the pointers to the start of the same array. In Java and C# it means the arrays are Reference Equal, b...
Read postExceptionless Programming
November 28, 2012 00:00
I am a big fan of writing code that generates no runtime errors. This is an implementation of a function that takes the first element of an array.
template<typename T>
T first(std::vector<T> array)
{
if (array.size() == 0) { throw EmptyArrayException(); }
return array[0];
}
This is ...
Read post