Re: Trying to use gdb on OS X

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...

I'd say we should use int64_t, as that's standardized, while 'long long' is really a GNU extension.

Thankfully we no longer have to worry about Watcom. (IIRC it doesn't support either, we'd have to use __int64 or something there if we needed a 64bit integer type for some reason.)

Yes, we do this on 4.1, but he's trying to get 4.0 working under OSX. This is very disappointing. Could you try the following program?

#include <stdio.h> 
 
void convert_double( double d ){ 
	long l = (long) d; 
	unsigned long u = (unsigned long) d; 
	printf("%g -> %lx %lx\n", d, l, u ); 
} 
 
int main(){ 
	convert_double( (double) -1 ); 
	convert_double( (double) 0xdeadbeef ); 
	return 0; 
} 
 

I tried this two different ways:

$ gcc -m32 test.c -o test && ./test 
-1 -> ffffffff ffffffff 
3.73593e+09 -> 80000000 deadbeef 
 
gcc -m64 test.c -o test && ./test 
-1 -> ffffffffffffffff ffffffffffffffff 
3.73593e+09 -> deadbeef deadbeef 

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu