Silly thoughts about the history of C/C++ coding

Note, this is meant to be taken more tongue-in-cheek then seriously, take offense at your own expense 8=).

  • All the fun C library extensions can be blamed on UNIX, less intelligent systems still don’t implement them ^_^.
  • Most of the stupid type systems out there are reminiscent of the Win16 API, watch out for the Hungarians in the group.
  • Too much programming for Windows can lead to strange tattoos, that’ll get you sued unless you’re a pioneer.
  • There’s enough C++ Hungarian in the gaming industry, to make you want to go parler français with the ladies instead.
  • If you want to sit in your own little world, stick to mobiles or Macs; or ask the Free Software Foundation for this weeks KoolAid.
  • It’s alright if you need a road map to find your way through all that DDE/OLE/COM/ActiveX/DCOM mess and their variants, so does Microsoft: that’s why they invented .NET for your InterCOM.
  • Watch out for the babes in the null pointer cafe.
  • sizeof(foo) ≠ sizeof(foo*); unless thou hast vilolated the tenth commandment.

So busy, food even fell by the way side :-S

I spent yesterday experimenting with DevIL, I rather think that it will be more “To my taste” then using SDL_image for getting easy access to various image files. I only expect to use certain image formats in my games kit, but ahem, if that ever changes, who wants to write per-image-type handling code anew? Hehe. In playing with that, I’ve uncovered a bug in my zipped package handling, and have coded myself into a corner, where in the system would best serve me, by growing a more abstract file handling API—exactly the direction I wanted to go in, hahahaha! TBH, I’ve only ever coded myself into two corners in my life, but this ones a happy case.

Most of the night was used in experimenting with a pair of Integrated Development Environments, CodeLite and Code::Blocks, as possible replacements for existing build.{sh,bat} scripts. There is also a Visual C++ solution and project tree that I whipped up Thursday to replace build.bat, and am still cursing at over its dislike for by build tree o/.  In terms of IDEs, Microsoft has the best, but like visually everything at MS, it’s also as vendor specific as writing machine code in octal 8=).

Really, I can care less about having compiler, editor, debuger, … all integrated—other wise I’d use GNU emacs, screen, toolchain, and their dialect of C, and spit on everyone else’s graves >_>. The thing that interests me is having a suitable build system, one that can handle multiple compilers/configurations and multiple OSes readly, because `tmk` is a project on my back burner, and won’t be completed anything in the short term. Code::Blocks like modern MSVC/VC++, the file format is XML driven and quite easy to modify in a standard text editor.

Installing various libraries on Windows has shown me – most developers don’t know how to create a build system. At least, most open source developers can’t seem to combine computer science 1.0.1 with Visual Studio projects.

Installing various programs on Unix systems, has shown me – many developers don’t understand autotools or it’s just to complex a build system (I vote for both).

Me, I say fuck y’all. Do it right or don’t let it leave your workplace.

And so passes another black day

I’m rather glad to be heading back to work, and happy to see the 12th go. January is generally regarded as an off month in my family… January 12th, 1989 is the day my father died, as well as my parents wedding anniversary—what a peachy combination!

While I try to respect my families history, it’s also a matter I try not to dwell on for very long. *sighs*.

Bye bye work week!

Finally finished with a nutty schedule, this week is a bit more free, although I’m still working on the weekends. Things have been erratic lately, I’m not sure if that’s a good thing or a bad thing. Honestly, I like it when things are shaken up a bit, although routine does help with planning events around working hours!

My dreams have been a rather nasty torrent lately, mixing interesting possibilities with programming, and more moribund territory. On the first, I’ll skip journaling, to the second, it’s mostly revolving around C and OpenGL, I’m even dreaming of coding these days o/, and as to the third, somethings are too grisly to be worth recollection.

I’ve managed to get everything done today, and still find about an hour or so to take a much needed ‘break’, haven’t had one of those in a coon’s age. For now, I’ll probably take in a quick game of Quake or some Raven Shield. Later tonight, I need to mull over some more of the OpenGL issues and such. Oy, scratch that, dinners on the roll. It seems, one thing that never does end, is my ability to think 8=).

All in all, I’m looking foreward to Monday—I’m off work :-D.

*sigh*

There’s nothing todo, other then pass time and work across open projects :-/. Normally I would be working today, but the snow and ice has pushed into into Saturday, which is probably good fortunate since I’m scheduled for working most of the weekend anyway o/.

I’ve all but been going stir crazy for the last couple of days, although on the productive side, I’ve had some time to study OpenGL in greater depth. Ahh, joy. Can’t even blog in peace…  hours go by through interruptions.

The last couple of days have only been marginally productive :-(. The infrastructure for Stargellas console is virtually complete, except for the prerequisite renderer code. Soon it’s time to move on with the usual loop, progressing to [SAS] related projects, then cycling to EPI, and back again to my usual loops.

My dreams have been someone erratic lately, but so far, have remained quite consistently the opposite of whatever I’m thinking about when I drift off to sleep. I’m not sure if that’s a good thing or not. It seems no matter what, it’s virtually impossible to sleep without thinking, short of working myself to exhaustion. While maintaining a deep holmesian focus seems to be great for pushing everything out of mind, keeping that up for more then a few weeks is staggering :-/.

One good thing to come of today in particular, was scoring a 95% on the driver’s practice exams on the relevant state website. I can’t help but wonder, if some of the multiple-choice answers were intended for evaluating brain damage, but hey, maybe I’ll pass it. I’ve also found out that out here at least, being in my current age group, I could forgo the learners permit and skip straight to an exam for a full driver’s license, but rather would prefer the proper chance for learners-time. Although, I still expect family to fsck me in the end o/.

A fairly full work week is starting off tomorrow (the one luxury of being off Mondays, is work begins Tuesday). If it wasn’t passing 02:22 local time, I think I would grab a snack and read the a few standards cos, but alas, time to hit the hay, eh, pillow.

Much of the last few days has been spent in toying with data structures, and testing a few dozen hash functions for use with a simple hash table module. It’s actually the first time I’ve ever had to implement a hash table myself, lol. It’s a fairly simple creation built on top of chaining.

The perfect hungry mans analogy for those that know squat about data structures: let’s say you want to find a recipe for peanut butter cookies in a cook book. You could thumb through every couple pages of the book, looking for cookie recipes, or even flip over to the index in back, and depending on the quality of the index, hunt down by looking down the index and systematically checking all cookie references; linked lists and arrays more or less work similar. A hash table is more like a table of contents: you flip open the book, go to the ToC, and find the section with the cookie recipes, then flip to that page and start flipin’ every few pages until you find the one you want.

Hash tables work essentially the same way, you feed in the key (peanut butter cookies, yum), hash it down to an index to where you can find the target. Although hash functions that don’t collide (often enough to care) are possible, when you have to bind the generated index within a given size, the odds of several different keys sharing the same index skyrockets. So instead of a direct 1 to 1 mapping, you have a needle to which haystack mapping.

My implementation uses a dynamic array of bucket lists that are allocated with HashTableCreate(), each element is a list: every key is hashed then squashed down to the size. When a new key:value is inserted, it gets added to the bucket list. On look up, the key is hashed back to the same value in order to find the correct list, in which to hunt down the correct entry.

One reason I chose separate chaining, other then it fits with how my brain works; many schemes for open addressing (the alternative), feels more like something I would think up, in order to skip writing a hash table >_>. Although, I must admit the possibilities of  open addressing combined with quadratic probing are interesting; I’m more in favour of the chains. While I doubt my implementation is memory efficient—since the only two design goals were to be faster then a (pure) linear search and quick to hash out the code, it undoubtedly has it’s flaws. For the sake of testing how it effects the intended usage, I may try augment/replace the current behavior of prepending new entries to the lists with moving last requested keys to the head, or switch to using red-black trees in place of a linked list.

I spent several hours testing different hash functions, using a small input set of words and a larger system dictionary file for testing. HashTableCreate() allows one to specify which hash function should be used, and it’s possible to override with a user supplied one. In testing, I’ve found using hash functions created by people with a background in mathematics, works significantly better then my own, as duly expected lol. Other then dealing with hash function issues, the rest was a cake walk.

Of geeks and logs

Took it ‘easy’ yesterday, played some games and the only work that got done, was fairly light debugging / library installing / feature adding. Originally I planned to setup expat, libxml2, and libxslt under MinGW/MSVC, but called it a night after expat. Found an interesting thread on Daemon Forums, which shows either I really need to get a life, or a good nights sleep.

Grabbed a trio of cookies, put on the simpsons, and went to bed early, around 0100R; the easier solution :-o.

Had a fair bit of trouble getting to sleep as always, but being winded helps. By a quarter to 0700R, I had already woken up three times :-/. It was a half past noon when I finally got out of bed, not being disturbed makes for an interesting opportunity to sleep like a log and enjoy crazy dreams lol.

For my p resent activities, I’ve merely worke don importing my Live Journal entries from February 2009, into Blogger. I don’t think I’ll make my goal of having it all done before 2010 arrives, but alas, it will get done eventually!

Local time is reading 01:40R, so it seems that I’ve survived another Christmas on this rock. Much of the day, has really been spent trying to avoid the holiday altogether, for all practical intents and purposes. At least I got plenty of C code written for my games :-/.

The only real good thing out of the day, was a the ecard a friend sent—my one smile of the day.