Today was a good day for someone (else's code) to die.
I worked around a major problem (and, as far as I can tell, a specification violation) in a third party's software.
I helped track down, identify, and kill a leak in our own code.
And, to top it off, I ended up digging through the C++ spec to try and understand why the compiler happy to use a static const int member from a class on one line, but decided to complain that the same value was "undefined" a few lines later [1].
It. Was. GLORIOUS.
Seriously. Any day that gives you an excuse to grunge through the C++ spec is a good day.
[1] For the C++ geeks in the audience, here's an example of the what I was seeing:
$ cat -n main.cc
1 template T min(const T& l, const T& r) {
2 return ((l < r) ? r : l);
3 }
4
5 struct A {
6 static const int X = 1;
7 };
8
9 int main(int argc, char** argv) {
10 int x = A::X;
11 return min(0, A::X);
12 }
$ g++ -g main.cc
/var/tmp//ccLpbLY5.o(.text+0x22): In function `main':
/home/samrobb/main.cc:11: undefined reference to `A::X'
No comments:
Post a Comment