Sony guts

Gamasutra has another “here’s a neat code snippet” article. Normally I enjoy these, but as I dug into this one I found myself getting more and more worried. Article

Code is here.

1. GetID assumes the linker does not collapse template functions that have the same binary rep (i.e., GetID != GetID).
2. GetID truncates function pointers to ‘unsigned int’ (might be okay).
3. Heaven help you if you have a name string less than three characters long.
4. The “Hash table” is really a linear search.
5. Doesn’t handle collisions, just refuses to add (to be fair, the article mentions this).
6. Not thread safe, doesn’t even try. (Why even bother with something like this if it’s not thread safe?)
7. Some bits of the code think that the string can be null, other bits don’t. Which do you think are correct?

Stylistically, apparently the author doesn’t think that sizeof works on an array, left some debug code in (FwHashedString?), and chose a plethora of various return results that look like a nightmare to deal with on the caller’s side of things.

Author: landon

My mom thinks I'm in high tech.