MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: value bytes of error codes



On Thu, 28 Mar 1996, Don Schwarz wrote:

> On Thu, 28 Mar 1996 slayer@kaiwan.com wrote:
> 
> > I was just wondering why something like value_bytes(E_PERM) returns 0. Do
> > error values take up any space in the database? If so, how much?
> > 
> My guess would be because the compiler takes care of allocating the memory
> for errors, integers, etc. as opposed to lists and strings which the MOO
> allocates and frees itself.  So yes, integers and errors do take up space. 
> On disk, they just take up the amount of space it takes to print
> them (1 character for '5', 6 characters for '123456', etc) but in memory, I
> believe all integers take up 32 bits, and errors take 8, but I'm just
> guessing, I haven't actually checked the code.
>                                                                --Dark_Owl
> 
	An error in memory is part of a Var structure, which contains a 
union of, among other things, a char *, so the Var struct is as large as 
a char *--generally 4 bytes--plus the size of the type field, which may 
be 2 bytes, but will effectively be 4 bytes on many systems due to struct 
alignment on 4-byte word bounderies... 

--Nick Ingolia

ningolia@[oxygen|neon|stu].ci.lexington.ma.us
ingolia@molbio.mgh.harvard.edu




References:

Home | Subject Index | Thread Index