NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Ensuring portable code (Score:1)
A bit of both. There's no substitute for testing on different machines (and with different compilers), but you'll have a lot less problems if the first place once you become experienced in what is and isn't portable
Part of the problem with portability is that the most common platform (x86) is one of the most forgiving (little or no alignment contraint on pointers, no structure padding), and the most common compiler (gcc) is similarly lax. Bondage and discipline is good for you, but sadly they are not even the implicit default.
For example, your module is also failing its tests on PPC linux, so I'd suspect that it's an endian-ness bug somewhere (your code, or the included library), as both sparc and PPC are big endian. (ie I'm guessing that your code and the library is mostly tested on x86). If it had passed on sparc, but failed on PPC (and ARM; usually little endian) then my guess would be that it woudl be a plain
charissue (charis unsigned on PPC and ARM, signed just about everywhere else.)The you start to get to more esoteric stuff, such as what happens when you ask for a logical shift larger than the integer (undefined behaviour in C, this might actually be your probkem here), or signed integer arithmetic overflows (undefined behaviour, but it turns out that it will do what you expect, if you think it should just do 2s complement, on most platforms except for 64 bit Irix and UTS), whether
sizeof(long)isn'tsizeof(int), whether a pointer is larger thanint, whethersizeof(short)isn't 2 (on Crays it is 8), how bitfield ordering works, is'\n'actually 10, is'A'>'1', etcReply to This