www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/28/18:38:56

Xref: news2.mv.net comp.os.msdos.djgpp:3219
From: stwand07 AT uctvms DOT uct DOT ac DOT za
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sizeof(int) == 4?!
Date: 28 Apr 96 21:58:36 +0200
Organization: University of Cape Town
Lines: 31
Message-ID: <1996Apr28.215836@uctvms.uct.ac.za>
References: <4m03nd$nsc AT freenet-news DOT carleton DOT ca>
NNTP-Posting-Host: uctvms.uct.ac.za
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <4m03nd$nsc AT freenet-news DOT carleton DOT ca>, br516 AT FreeNet DOT Carleton DOT CA (Nicholas Lynch) writes:
> Borland C/C++:
> 
>   Variable         Size
>   ---------------------
>   int              2
>   unsigned int     2
>   long             4
>   ...
> 
> But in DJGPP:
> 
>   Variable         Size
>   ---------------------
>   int              4
>   unsigned int     4
>   long             4
>   ...
> 
>  Is there any way of correcting this?

There isn't anything wrong! DJGPP is a 32-bit compiler, as opposed to Borland
C/C++ which is 16-bit. So, an int in Borland is 16 bits, but in DJGPP it is 32
bits. If you want a 16-bit int (also called a word), use "short" or "unsigned
short". The use of long has no effect in DJGPP since int's are "long" (32 bit)
by default.

I'm sure this is in the FAQ, but if it isn't it should be.

Adios
Mark Wodrich.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019