On Sunday, July 13, 2003, at 1:11PM, M. Warner Losh wrote:
In message: <[EMAIL PROTECTED]> Jilles Tjoelker <[EMAIL PROTECTED]> writes: : The compiler moans about (T)(-1) >= 0 as well. Is the assumption that : (unsigned type)(-1) is never zero valid?
yes. There are no known machines where -1 == 0 for types of different signs. Further, the C standard says that it must behave as if it is a two's complement machine, and I think that C++ says so too.
I am pretty certain you can do one's compliment in the C99 standard, and that
some of that is implementation/platform dependant.
See section 6.2.6.2 of the C99 standard which enumerates the following 3 negative number representations:
¡Xthe corresponding value with sign bit 0 is negated (sign and magnitude);
¡Xthe sign bit has the value-(2^N )(two¡¦s complement);
¡Xthe sign bit has the value-(2^N -1) (one¡¦s complement).
further:
"Which of these applies is implementation-defined, as is whether the value with sign bit 1 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for one¡¦s complement), is a trap representation or a normal value. Inthe case of sign and magnitude and one¡¦scomplement, if this representation is a normal value it is called a negative zero. "
Yes... a negative 0.
Warner
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "[EMAIL PROTECTED]"