Go GCC vs GC

For awhile now I’ve been playing around with a stack based language written in Go. The specifics of that project aren’t too important here, but I did notice something interesting today as I tried GCC for the first time with the project. First I wanted to make sure it worked so I ran go-5 test and happily all tests passed. Next, I thought I’d see how the benchmark looked. Here I think I was most surprised. Every single benchmark I had written was between 1.5x Continue reading →

Go UTF-16

This is just a small code fragment that prints out the Unicode characters from the Fullwidth Latin Letters (range 0xFF01-0xFFEF). This works on little & big endian machines (tested with qemu-arm & qemu-mips compiled using gccgo 4.7.) I thought it might have issues with the way it decodes the int32 into a byte array and re-encodes it to a uint16 array. package main import ( "bytes" "encoding/binary" "fmt" "unicode/utf16" ) func main() { for i := int32(0xFF00); i

HGE Go work

I just realized I never actually posted about why I was doing a C binding of C++. Basically I bound most of Haaf’s Game Engine (HGE) from C++ to C. I ended up getting a bit stuck on the GUI elements and getting a nice way to let them do simple inheritance and polymorphism based on the current C++ classes. This actually wasn’t a problem for my end-game which was to take that C binding and make a Go version with cgo. I had initially Continue reading →

C Bindings for C++

Lately I’ve been playing around with writing C bindings for a C++ library. Your first thought might be, “Why would you bind a C++ to C?” Those of you who have ever had to do bindings to other languages may already know the answer. In general, it’s much easier to bind C to another language than it is to bind C++ directly. Another, albeit less likely, reason might be because a client wants a C interface instead. You may be asking your self at this Continue reading →