[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: apr_off_t is of an ambiguous size.

From: Kean Johnston <jkj_at_sco.com>
Date: 2004-01-17 02:32:20 CET

>>min = 0x8000000000000000 = -9223372036854775808 = -2^63
>>max = 0x7FFFFFFFFFFFFFFF = 9223372036854775807 = 2^63-1
Bad code.

Those constants cannot be expressed on a platform that does not support
64-bit integers. Even on platforms that do if you really get a long long
the compiler is being generous. They should be suffixed with LL, or ULL
for unsigned. Type long long is, I believe, an ANSI extension, its not
base ANSI (but I may be wrong on that point).

> For whatever reason I always thought of the << and >> operators as
> literally shifting the bits left or right. Rather they should be
> described as shifting fromt he low bit to the high bit and the high bit
> to the low bit respectively.
That is one and the same thing. You're dealing with numbers here, not
data busses and in-memory representation. Just as a decimal number, in a
little endian machine, is not expressed differently, neither is a binary
number. For the purposes of the shift operators, you are shifting a
binary number, either left or right by a given number of bits. How those
bits are implemented in memory should never be a concern (until such
time as they are stored or transfered over a non-memory mediam, such as
a network).


To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jan 17 02:34:07 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.