Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I don't know if this has anything to do with it, but I've seen that some [tt]printf[/tt]s don't support 64-bit integers properly; printing, for example, 0x0000 0000 0000 0014 (20) might produce only the first 32 bits, 0x0000 0000 (0), because [tt]%i[/tt] or [tt]%d[/tt] will only see 32-bit values on the stack. Something similar may be happening with your [tt]printf[/tt]; if any values that follow in the arg list are also borked, then that's my diagnosis.
Something similar may be happening with your printf; if any values that follow in the arg list are also borked, then that's my diagnosis.
I misunderstood this too, what viral is trying to do is print the sizeof a long long which is only 8 bytes and the structure is as someone else mentioned is 20 bytes, so %d will easily handle it.
I'm guessing you're using the gcc that comes precompiled for your system
What happens if you compile a really simple program in c++, which has the structure definition and a main function which prints the size the struct and does *nothing* else? If that fails, try building your own gcc (maybe even as a cross-compiler - see the osfaq).
If you are using a gcc you build yourself, try rebuilding it and if possible run 'make check' before installing - the c testsuite should catch this sort of problem.
Another trick is to use 'gcc -S' on the source file to get assembly language output, or 'gcc -E' to make sure it isn't a weird pre-processing definition which is ruining the code.
Try printing the size of a packed structure (see the gcc manual).
And try everything else you can think of to isolate what is causing this bug because it is very, very strange.
And try everything else you can think of to isolate what is causing this bug because it is very, very strange.
Ya the bug is really very very strange and thts why I change my code from long long to simple unsigned int.
Now its working nicely as no long long manipulation needed.... I dont see any benifits in wasting time to debug that ugly long long issue.. better I switch to more general format..