delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/08/15:42:26

Date: Thu, 8 May 1997 15:41:37 -0400
From: Bryan Murphy <bryan AT hcst DOT com>
Subject: long long int assignments
To: djgpp AT delorie DOT com
Message-ID: <Pine.3.89.9705081555.A32279-0100000@alpha.hcst.com>
MIME-Version: 1.0

I have a sequence of assighments that follows like this:

unsigned long long int millimeters = (unsigned long long int)-1;
unsigned long long int centimters  = millimeters / 10;
unsigned long long int meters      = centimeters / 100;
unsigned long long int lightspeed  = 96100000000000000;
etc. etc.

The whole idea was to see how much space could be accurately modeled
down to a millimeter's accuracy.  I came up with about 1.9 light
years (quite a bit!!).

Anyways, if I don't type cast centinal values when assigning them to
long long int types, I get a warning telling me the value is out of
range, yet the long long int receives the value fine.  Any reason why
this happens and what can I do to stop the warnings short of typecasting
every big assignment?

Also, how well does a pentium handle long long ints vs. short ints, 
integers, and long integers in terms of speed?  Can I expect a 
substantial amount of overhead by using long long ints, or is it rather 
negligible?

- Raw text -


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