Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: (NULL == 0) ?



> >A couple of other questions about Unix and C standards: does anything
> >guarantee that a variable is always 8 * sizeof(var) bits long?
> 
> Only if a byte is 8 bits long and there are no holes in the integral
> types.  This type of holes are very rare, and we assume 8 bit bytes
> elsewhere.  I don't think we actually assume this directly anyway.

It is used to determine the size of buffers to store the string
representation of an integer.  Just grep for 'SIZEOF_LONG \* 8'.

> >          Does any Unix or C standard guarantees that an int always has at
> >least 32 bits?
> 
> No.  But C guarantees that long is at least 32 bits, so if there's
> anywhere we need 32 bits we should change it to use long.  I don't know
> of anywhere in zsh tht needs fixing in this respect.

ntype in struct node has to be at least 32 bit long but it is defined to
int.  But it would be wasting of memory to use long on systems where int
has 32 bits and long has 64.

In hashtable.h it is assumed that sizeof(void*) >= sizeof(long).

Zoltan




Messages sorted by: Reverse Date, Date, Thread, Author