Tuesday, November 15, 2005

g95, actually quite cool...

A colleague of mine has been porting some code from Linux on Intel to Mac OS X on Power PC and he ran into endian problems. The solution to this normally involves writing a whole bunch of tedious byte swapping code, but it appears that one of the things that the new(ish) g95 Fortran compiler does is allow you to configure endianness at runtime using an environment variable,
% setenv G95_ENDIAN big
which is actually quite a cool thing to be able to do, although since the byte swapping code is going to be compiled into every single executable you have to wonder what sort of overhead this not commonly used feature is adding...