Sebastian\’s Coding Blog

Archive for June, 2006

build & linux

Posted by randomz on June 28, 2006

I just tried to check out and build the Sofud code on my Debian Linux system. While building build itself worked fine, building the Sofud test program posed a problem. Build ended up putting the object files to each module into the current working dir, in which test.d also resides, instead of the Sofu subdirectory, where the Sofu source files reside. For linking, gcc looks for them in the Sofu directory, and fails.

However, I also haven’t been able to link them together manually, or build the program by hand using the dmd compiler, due to some unresolved references (despite linking libphobos.a in)… but I guess I’ll look into that again once the build problem is fixed.

It’s a pity that setting up dmd on linux is such a pain… although there must be people using it…

Posted in D | Leave a Comment »

D enums != type safety

Posted by randomz on June 28, 2006

I’ll post here the last post from my old coding blog, since I just wrote it a couple of minutes ago:

Copy & Paste struck on me again, as it often does. I had written a function to take a Sofu.Encoding.Encoding enum value (which is one of the possible Unicode encodings) and return the endianness that will be used by that encoding, as an Endian enum value.
However, I had pasted this from code that used’s BOM enum type. So, I had written:

switch(encoding) {
  case BOM.UTF16LE: case BOM.UTF32LE: return Endian.LittleEndian;

Of course, I should have written

switch(encoding) {
  case Encoding.UTF16LE: case Encoding.UTF32LE: return Endian.LittleEndian;

This actually caused little and big endian to be exactly reversed.

I guess this is a serious downside of having the enums be actual int variables. The compiler wasn’t able to see that I was comparing an Encoding enum value to a BOM enum value.

Oh, and BTW, the SDL_mixer bug has been fixed and I was able to check the new DLLs into the Evilness SVN. 🙂
(Not that anything has changed over the old version…)

Posted in D, Sofu, the Evilness engine | Leave a Comment »