c++.dos.16-bits - 32-bit emmulation bug
- Imran Haider (9/9) Oct 02 2001 charset="iso-8859-1"
- Walter (21/21) Oct 04 2001 charset="iso-8859-1"
charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 'unsigned long' variables don't work in 16-bit mode. They only work with = 32-bit mode. In 16-bit mode, I think assigning a long variable more than = 16-bits (64k) is broken into high-word and low-word. The low-word is = used in the variable and the high-word is deleted. unsigned long in 16-bit mode takes 2 bytes of RAM when it should be = taking 4 bytes. So in another words: sizeof(unsigned long) =3D=3D sizeof(unsigned short)
Oct 02 2001
charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable The following program prints "4" as expected when compiled with -ms or = -ml: -------------------------------------------------------------------- #include <stdio.h> void main() { printf("%d\n", sizeof(unsigned long)); } ------------------------------------------------------- Imran Haider wrote in message <9piqdp$247e$1 digitaldaemon.com>... 'unsigned long' variables don't work in 16-bit mode. They only work = with 32-bit mode. In 16-bit mode, I think assigning a long variable more = than 16-bits (64k) is broken into high-word and low-word. The low-word = is used in the variable and the high-word is deleted. =20 unsigned long in 16-bit mode takes 2 bytes of RAM when it should be = taking 4 bytes. So in another words: =20 sizeof(unsigned long) =3D=3D sizeof(unsigned short)
Oct 04 2001