Message-Id: <33687406.4378@canvaslink.com> Date: Thu, 01 May 1997 06:44:22 -0400 From: Tom Grandgent Reply-To: tgrand AT canvaslink DOT com Organization: Canvas Link, Inc. Mime-Version: 1.0 To: "Jon A. Cruz" Cc: djgpp AT delorie DOT com Subject: Re: ints vs. shorts References: <3366B866 DOT 5466 AT canvaslink DOT com> <336786BD DOT 2F73 AT twinsun DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Jon A. Cruz wrote: > > Sorry for this, but you just hit a little pet-peeve of mine. > > >From your context, I believe that you should really be saying longs vs. > shorts > > Coming from 16-bit, you should realize the difference. > > int != short > int != long Yes, I have known this since I made the switch to DJGPP. However, in a 16-bit environment, int did = short, which is why I never used short. So now int = long, instead of short. So my question was, do I put short all over the place where I used to use int, or should I keep using int for most things because of performance issues? > int == is whatever the compiler determines is most efficient for the > processor. Ok, that makes sense. > int may be same size as long > int may be same size as short > short may be same size as long > short may not be smaller than long. Interesting.. Didn't know short could = long.. :) But how can short not be smaller than long? Under DJGPP, short is 16 bits and long is 32 bits. Correct? > Never read or write ints from your program to files, network, etc. > Use short or long. Ok, this is the answer to the question I was trying to ask. So, on the PC, short is always 16 bits and long is always 32 bits? That's what it seems like to me. So you're saying to use short and long for I/O purposes but use int for internal things.. For example, I have a structure that contains the information for a ship in my game. Coordinates, health, fuel, all kinds of things like that. I am trying to determine whether it would be better to use ints or shorts for these sorts of things, as well as others. Thanks, Tom Grandgent tgrand AT canvaslink DOT com Canvas Link, Inc.