Doubt debugging a program

1

I was debugging a program and the following question came to me, had architecture is 32 bits Intel and had the following instruction MOV EAX, DWORD PTR SS [0X401049], and below that instruction had the following command EDX MOV, DWORD PTR SS [0X40104A]. My question is that in the first statement the EAX record received 4 byte data, and in the second only one byte of data.

The reason for this is that each memory address in a 32-bit architecture has 32 bits.

Would not it have to transfer 4 bytes also to the second statement?

    
asked by anonymous 12.10.2015 / 19:40

1 answer

1

They do not necessarily need to be 4 bytes. For example, when working with several type sizes we can use both 4 bytes and 8 bytes as 2 bytes. It does not matter what size, because the computer architecture corrects that flaw by jumping to the next value after the word.

For example, if you use a char, it will occupy only 256 bits of the word, which refers to 2 ^ 8. We know that if the architecture of a computer is 32 bits then each word will have 2 ^ 32, but it is not a determining factor. Each type has a certain size in architecture, independent of it.

Take a look at climits and see what I'm talking about, there you find all the bit limits of the types in C. It will be evident that it is not always necessary to occupy the 4 bytes of a word!

    
14.10.2015 / 19:50