Re: long vs. int

From: William Wallace (wallacew@nz.dialogic.com)
Date: 09/20/95


At 06:23  20/9/95 -0400, Sean Mountcastle wrote:
>
>	I have two questions, and not a very good subject line ;)
>
>	First, since the bitvectors start off at 0, if the maximum 
>bitvector 2^31 or 2^32 (21474883648 or 4294967296) that can be contained 
>in the long variable?  Pretty easy question eh?  I know, I know, but I 
>forgot and can't seem to find it.

Look in the limits.h include file. This should define the maximum and
minimum values for all integer types on you system. I think the defines you
will want are LONG_MAX, LONG_MIN, INT_MAX and INT_MIN.

>	Next, I've tried to change all the references to vnums and rnums 
>to long from int, so I can increase the total number of rooms/obj/mobs in 
>the game - this seems to have no effect, except when I change the line in 
>db.c if (nr >= 99999) return;  I made this much larger to reflect the 
>nature of long integers, but everytime I do this the MUD crashes upon 
>boot-up with the error message: Room %ld is outside of any zone (%ld = 
>virtual_nr) this is shortly after the if statement (++zone > 
>top_of_zone_table)  - anyway I can fix this?

Under ANSI C an int is at least 16 bits long. A long is at least 32 bits
long. Therefore changing all vnums and rnums to ints will not increase the
number available.



This archive was generated by hypermail 2b30 : 12/07/00 PST