I was able to reproduce the bug with the following code (compile: g++ -Wall -O2 x.cpp)
#include <stdio.h> #include <fstream> typedef unsigned int Uint32; inline Uint32 read_u32(std::istream& in) { Uint32 i; in.read((char*)&i, 4); return i; } inline float read_float(std::istream& in) { Uint32 u = read_u32(in); return *(float*)(&u); } int main() { std::ifstream in("test"); for (int i = 0; i < 2; ++i) { float x = read_float(in); float y = read_float(in); float z = read_float(in); printf("x=%f y=%f z=%f\n", x, y, z); } return 0; } with this test file: (hexdump test) (2x the float values 1.0, nearly 1.0, and -1) 0000000 0000 3f80 ffff 3f7f 0000 bf80 0000 3f80 0000010 ffff 3f7f 0000 bf80 the output is: x=0.000000 y=1.000000 z=1.000000 x=-1.000000 y=1.000000 z=1.000000 which is clearly wrong. the first x should be 1.0 In fact the values for x,y,z are all wrong, because the stored values are 1,1,-1 in that order, not -1,1,1. Compiling the code with -O1 gives the correct output. Seems to have something to do with parameter order on the printf call or something the like. Hope this helps... -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]