Re:CR2 empty?
Posted: Fri Mar 25, 2005 3:49 am
bochs says it's bogus memory... why don't i get an exception or something, or why doens't the kernel crash ???
That sounds extremely scary to me. This is not an x86 thing. this is a compiler thing.AR wrote: On the x86, char and short are scaled up to int anyway
Code: Select all
char byte=0xff;
Code: Select all
int negative=-1;
if (byte == negative)
Code: Select all
int negative=-1;
if ((int)byte == negative) ...
Code: Select all
negative dd 0xffffffff
bite db 0xff
mov eax,[negative]
movsx ebx,byte [bite]
cmp eax, ebx
I did clarify by saying "GCC 32bit aligns it to speed up access"Pype.Clicker wrote: That sounds extremely scary to me. This is not an x86 thing. this is a compiler thing.
reading at inexistant physical memory usually returns "-1". under bochs, it also complains about "bogus memory". My guess is you *have* a page table entry for it (for some reason), but it's filled with garbage that sends the CPU to some memory that doesn't exist.Poseidon wrote: it's always -1 ???. does anyone have a d*mn idea why this is happening, otherwise i'll post some code.
Nope. char doesn't behave like int, in this regard. Whether 'char' is signed or unsigned is "implementation defined", which means you can set your compiler to do either. Assuming signed char is commonplace, but by no means mandatory.Pype.Clicker wrote: Char (same way as 'int') are _signed_ numbers.
Just did so. You are right about the comparison thing though.Solar, hit me back if i'm wrong here, will you ?)
...is still an invalid assumption.since the pattern "FF" is "-1" for a char...