From: "matthew p. conte" Newsgroups: comp.os.msdos.djgpp Subject: Re: int being 2 or 4 bytes long Date: Sun, 1 Mar 1998 17:17:20 -0500 Organization: little, if any Lines: 23 Message-ID: <6dcmjj$2ha@dfw-ixnews8.ix.netcom.com> References: Reply-To: "matthew p. conte" NNTP-Posting-Host: alb-ny8-24.ix.netcom.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Noam Rotem wrote in message ... >Maybe it's trivial, but why is there a data type which its size >can be different in different compilers? I refer to 'int'. Why >can it be 2 or 4 bytes, depending on the implementation? What's >the logic? I may be wrong, but I believe the ANSI standard imposes these rules: char 1 byte short <= sizeof(int) int <= sizeof(long) unsigned == sizeof(int) float <= sizeof(double) So you can see that there is a fair degree of latitude in how the size of the variable types are set. The sizes are probably based on the size that the CPU natively handles the fastest, i.e. 32-bit code would have a 4-byte int. Matt.