flatdog Posted September 17, 2010 Report Share Posted September 17, 2010 I have read the post explaining bits, numbers and hexadecimal and have a (very) basic question. If you take the offset for Autopilot altitude lock (07D0) it is documented as 4 bytes (and is therefore a DWORD?). As far as I can gather the offset on holds two values: 0 for off and 1 for on so why does it need 4 bytes or 32 bits to accomplish this. A link to further reading on this subject would be most welcome. Thank you, Philip Link to comment Share on other sites More sharing options...
Pete Dowson Posted September 17, 2010 Report Share Posted September 17, 2010 I have read the post explaining bits, numbers and hexadecimal and have a (very) basic question. If you take the offset for Autopilot altitude lock (07D0) it is documented as 4 bytes (and is therefore a DWORD?). As far as I can gather the offset on holds two values: 0 for off and 1 for on so why does it need 4 bytes or 32 bits to accomplish this. It doesn't. A single byte or even a single bit in a byte (along with 7 other switches) would have been more economical on space. But evidently Microsoft felt they had no need to be economical. It is probably a bit faster too to have everything in 32-bit variables when using a 32-bit machine. Also, if you are lazy when writing code in C or C++ (or most others too), then by default variables will take up the word-size specific to the compiler and target machine -- 32-bit compilers will compile "BOOL" (a boolean value, TRUE or FALSE, 1 or 0) into a 32-bit value and 64-bit compilers will use a 64-bit ("QWORD" or quad-word) value. Regards Pete Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now