Older blog entries for redi (starting at number 10)

bjf: Have you looked at WML?
3 Sep 2002 (updated 3 Sep 2002 at 10:35 UTC) »

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."
Edsger Dijkstra
I'm not sure I agree, but who am I to argue with Dijkstra?
28 Aug 2002 (updated 12 Sep 2003 at 08:42 UTC) »
xach's Nigeria 419 Scam beats the hell out of the original. Cheers for a giggle, xach!
I guess it's the online equivalent of inviting Jehova's Witnesses in and preaching to them rather than the other way round, just to see if you can twist their melons. My brother and I tried this with a couple of Mormons who stopped us in the street on friday night (or all times!)
Them: "Have you heard of the Church of Jesus Christ and the Latter Day Saints?"
Me: "Yes, I have actually, but it's not my bag. Want a toke on this? No, I thought not."
Bro: "Are you familiar with Sufism? Read any Idris Shah? Oooh, let me enlighten you..."
I have nothing against people who've "Got Faith", but I resent their assumption that everyone else is spiritually ignorant and is just waiting to be shown the light.
Oops, back to software...

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.)

Update: The 3rd Annual Nigerian EMail Conference

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".

Video Editing
Hoorah! Finished struggling with flaky hardware/win2k and captured all the video we want. Now for the fun part - editing it.
I've just been having a brief look at some apps for video capture and editing on unix (although most of them appear to be linux only) and it looks as though there's a lot more choice than the last time I looked. Unsurprisingly, I haven't seen anything as good as Adobe Premiere yet, that can do everything from capturing over 1394 to multi-track editing, but I'll keep looking, there must be something out there...

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! :)

drunen, if you happen to see this, I realise it's a long time ago, but I've just found your August 2000 diary entry from a google search for "pure virtual destructor" and felt I should point you to the Guru Of The Week on pure virtual destructors (which was Google's top hit, and what I was looking for). It might help you know the Tao of C++ ;)

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.

26 Apr 2002 (updated 26 Apr 2002 at 10:41 UTC) »

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"

1 older entry...

New Advogato Features

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!