www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/19/13:06:15

From: "M. Schulter" <mschulter AT value DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 8 Byte Integer
Date: 19 Feb 1998 02:46:34 GMT
Organization: Value Net Internetwork Services Inc.
Lines: 30
Message-ID: <6cg6ea$gfu$1@vnetnews.value.net>
References: <3 DOT 0 DOT 32 DOT 19980207131923 DOT 0083a980 AT dataplusnet DOT com> <34DCBB48 DOT 2F2D AT cs DOT com> <34e67037 DOT 6142732 AT news5 DOT bellatlantic DOT net>
NNTP-Posting-Host: value.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

: >> Is there a way so I can specify the size of an integer in DJGPP.  In MSDN
: >> help, it says that MSVC++ 5.0 has the following integer sizes:
: >>  <...snip...>
: >> I am doing a program that calculates prime numbers, so the bigger the
: >> better.  Is there any way I can get a 4 or 8 byte integer in DJGPP?

Hello there, and please let me knote that I'm answering a quote from a
thread where the original post seems to be missing.

My quick answer would be that for a 4-byte integer in DJGPP, just use int
-- unless you want to ensure compatibility with other compilers which may
define int as 2 bytes -- or maybe 8 bytes -- and decide to use the long
type (guaranteed to be _at least_ 4 bytes on ANSI C compilers).

While I tend to use int, people following good programming guidelines for
portability would want _not_ to assume that an int is 32 bits, especially
given the converse problems often reported by people who assume that an
int is 2 bytes -- a point convered in the DJGPP FAQ.

For an 8-byte int in DJGPP, you can use the long long type, although this
is GNU-specific and not guaranteed to be supported on all compilers, at
least under 1989 ANSI C, if I'm correct.

Maybe I'm missing something here, but in DJGPP it seems very
straightforward to me to get either a 4-byte or 8-byte integer.

Most respectfully,

Margo Schulter
mschulter AT value DOT net

- Raw text -


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