Date: Mon, 14 Dec 1998 17:14:29 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: =?iso-8859-1?Q?Veli-Pekka_Kilpel=E4inen?= cc: djgpp AT delorie DOT com Subject: Re: Incorrect increment? In-Reply-To: <01be2766$8b88d320$0a034ac3@vpk2.sci.fi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Mon, 14 Dec 1998, =?iso-8859-1?Q?Veli-Pekka_Kilpel=E4inen?= wrote: > I'm having a problem trying to increment a pointer of type unsigned = > char. When I use Rhide's debugger and moving step by step(F8) while = > monitoring the pointers "value" I see that instead of moving one byte = > foward, it'll go three. Did you compile with optimizations? If so, GCC could rearrange the code somewhat. If you want to be sure, add debugging printout (use cprintf, not printf, because the latter uses the transfer buffer and might mess with your _farnspokeb calls), and print the value of the pointer. > -Am I getting into trouble when not restoring the original selector? No. No part of DJGPP assumes anything about the FS register (used by _farsetsel). So you can do anything with it, provided that you load only valid selectors into it. > -The size of variables differ from what my tutorial says - integers are = > not two bytes long. Does this depend on the enviroment? Mine is PC = > Pentium. It depends on the compiler. DJGPP produces code where ints are 32-bit wide, no matter what your machine is. > How do I get one byte long integers? Use `char'. > -What will happen if I "overload" my integers trying to put too big = > number in it? They will overflow: first they will become negative, then go all the way to zero, then become positive once again. An unsigned int wraps around from UINT_MAX to zero.