Mail Archives: djgpp/1996/05/01/22:56:10
Xref: | news2.mv.net comp.os.msdos.djgpp:3313
|
From: | Erik Max Francis <max AT alcyone DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: sizeof(int) == 4?!
|
Date: | Mon, 29 Apr 1996 07:55:42 -0700
|
Organization: | Alcyone Systems
|
Lines: | 25
|
Message-ID: | <3184D86E.5D984265@alcyone.com>
|
References: | <4m03nd$nsc AT freenet-news DOT carleton DOT ca>
|
NNTP-Posting-Host: | newton.alcyone.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Nicholas Lynch wrote:
> Is there any way of correcting this? (I belive that this problem cropped up
> earlier in thee newsgroup, but I didn't save the solution :( Or, should I
> just use a different data type instead of int?
There is nothing to correct, because nothing is wrong. ANSI C does not put
limitations on the sizes of types other than that sizeof char <= sizeof short
<= sizeof int <= sizeof long. (Actually, there _are_ actually some further
limitations, but they don't go to the level of specifying the byte-width of
these types.)
The solution is to use the type on the platform and compiler that is useful to
you. In DJGPP (and most Unix systems), a short takes up two bytes. In fact, a
short is two bytes on most DOS compilers that I'm familiar with, as well.
Also, an unsigned X is always the same size as a signed X (where X is one of
the above fundamental data types).
--
Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max AT alcyone DOT com
San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
"Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
- Raw text -