Things I Should Care About but Don't, part mauve

chromatic on 2004-02-03T07:38:34

I don't particularly care about data alignment in memory. I don't write a lot of C these days. (Two small programs tonight would belie that, except that my device driver writing roommate helped me with one, not coincidentally to discover the actual memory layout of a struct.)

Of course, writing the SDL bindings for Parrot (and, yes, Parrot exists and, yes, you can write actual programs in it: witness examples/parrot/anim_parrot_logo.imc which runs at 680+ fps on my laptop) means I ought to care about the SDL data structures.

It turns out that XS (the Perl 5 way of accessing C libraries) has an advantage over NCI (the Parrot way of accessing C libraries). XS can manipulate C data structures directly, while NCI needs to wrap them in appropriate Parroty access glue. Of course, since I'm writing PIR (a nice wrapper around Parrot assembly), everything's a little verbose, but trying to give named access to struct members can take a lot of work. (That doesn't mean that SDL_Event isn't icky, though.)

Add to that alignment issues of structs, and things can get rather complicated pretty quickly.

Fortunately, I persevered, at least in the limited case. There's very little standing in the way of writing an actual (though simple) game with Parrot now. Give me another couple of weeks.