Path: utzoo!utgpu!attcan!uunet!convex!killer!ames!mailrus!husc6!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!earleh From: earleh@eleazar.dartmouth.edu (Earle R. Horton) Newsgroups: comp.lang.c Subject: Re: Absolute size of 'short' Keywords: unsigned wrap-around Message-ID: <9641@dartvax.Dartmouth.EDU> Date: 2 Aug 88 10:54:39 GMT References: <214@ISIDAPS5.UUCP> Sender: news@dartvax.Dartmouth.EDU Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton) Organization: Dartmouth College, Hanover, NH Lines: 14 In article <214@ISIDAPS5.UUCP> mike@ISIDAPS5.UUCP (Mike Maloney) writes: >Dear C-Heavies, > >Is the size of a (signed or unsigned) short integer guarenteed to >be two bytes? I need to manipulate and compare some unsigned ints >modulo 65536. It would be clean and convenient to just let the >machine handle my wrap-around from 0 to 0xffff and verse-vica. No. I have seen at least one compiler where sizeof(short) is one byte. About the only thing you can count on is that it is no larger than an int. You might be safe in 95% of cases in assuming that a short is shorter than a long, but I don't recommend even this assumption. Earle R. Horton. H.B. 8000, Dartmouth College, Hanover, NH 03755