Passed the technical test thing I took last week for a job, so I'm in for an interview. I'm quite surprised, as although the test was very easy, I spent too long on the C++ section crafting the perfect answers and stupidly ran out of time and didn't write anything for some other chunks of it (and wrote complete rubbish for the database bit as I rushed to scribble something down.) Nevermind, I'm the only person to get through to the interview. Which is nice.
You're modifying a string literal. String literals in C have type (non-const) char*, but are non-modifiable, doing so invokes the dreaded undefined behaviour, so a coredump isn't too bad, you should think yourself lucky you didn't rupture a hole in the fabric of the universe. In C++ string literals are const, but as Stroustrup The Wise explains:
The type of a string literal is "array of the appropriate number of const characters," so "Bohr" is of type const char[5].
A string literal can be assigned to a char*. This is allowed because in previous definitions of C and C++, the type of a string literal was char*. Allowing this assignment of a string literal to a char* ensures that millions of lines of C and C++ remain valid. It is, however, an error to try to modify a string literal through such a pointer:void f() { char* p = "Plato"; p[4] = 'e'; // error: assigment to const; result is undefined }This kind of error cannot in general be caught until run-time, and implementations differ in their enforcement of this rule.
Stroustrup, C++PL3E, §5.2.2
"Programming is one of the most difficult branches of applied mathematics; the poorer mathematicians had better remain pure mathematicians."I'm not sure I agree, but who am I to argue with Dijkstra?
Edsger Dijkstra
Found an ICE in mainline GCC, but probably didn't need to include preprocessed unistd.h file in the report since test case doesn't use anything from it (it used to, but I reduced it). Or maybe it doesn't ICE without unistd.h? Should have been paying more attention when I reported it - this diary entry is to remind me to check tonight!
Another reminder: fix JavaScript on my sidebars page: left "//" out of baseurl variable. Doh! Still works though. Mozilla won't let you add sidebars from local URLs, neither file://fnordikus nor http://localhost/ting is allowed to be used as a sidebar. I wonder why not. When I'm at home I want to have my sidebars loaded from the localhost, not across my dialup connection. Workaround: use external hostname instead of localhost.
(That's enough rambling nonsense - Ed.)
What have I been up to recently...
Fixed some dumbass copy'n'paste errors in PStreams - I should make time to work on it, rather than trying to do it in 5 mins late at night
Started converting the libstdc++ web pages to XHTML. It's a fairly simple process using sed, sh, vim and some scissors and glue.
Got annoyed at the MySQL people, but resisted the urge to fire off an angry email. In version 3.23.48 (I think) they made the mysqldump utility generate output that causes an error when you try to import the dump into any earlier version. Not the sort of change I expect from a minor minor revision, especially as it wasn't mentioned in the ChangeLog. The change was in the meaning of the --opt option, which from 3.23.48 onwards has the additional meaning of "make the output incompatible with all previous versions". Nice. No need to document that, no no no. You'd spoil the fun of letting people find that out for themselves. The option's supposed to have some use for the development version, 4.0, but for the stable 3.23 series it's ignored, or for older versions it means "cause an error".
I can't remember the last time I wrote any code outside of work. After a recent holiday I had managed to wean myself off the Playstation2 and was about to do some work on my little open-source project (including re-licensing to LGPL which I'd promised to do weeks ago) when someone lent me a great cricket game. Now I keep playing it until the sun comes up (which is when I notice the time and that I have to work in about 4 hours). I must get some more sleep, and then I'll find time to do fix the outstanding problems with PStreams. Yeah right.
async: i've found an alternative to overusing parentheses when writing (and thinking!) - which i do too - use hyphens - recently I find they map better to my train of thought - but that's probably just because it's about to be derailed by lack of sleep.
I would get an early night now, but have promised someone I'd help them with some DV editing. Why do people assume that because you're a programmer you'd love to install PCI cards for them and arse about with broken drivers and try to get Adobe Premiere working on a Celeron with only 64MB RAM that's already struggling to breaking point under Win2k? I might be able to write C++ in my sleep, but that doesn't mean I want to wrestle with bloody windoze instead of sleeping! :)
I've discovered that stopping drinking means I spend far more of my free time coding. I haven't decided yet whether this is a good thing or not.
Finally uploaded PStreams to SourceForge, CVS repository due to be imported soon.
PStreams has at least one user now, so I'll have to do more
work on it and make sure it actually works.
Then I can relicense it and make millions. bwah hah
hah! GPL my arse! ;)
Registered my PStreams
project at SourceForge.
Written more <algorithm> documentation for
libstdc++, only merging, binary searching, set and heap
operations to go, "almost there ... stay on target"
New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.
Keep up with the latest Advogato features by reading the Advogato status blog.
If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!