[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: Russell Yanofsky <rey4_at_columbia.edu>
Date: 2004-01-17 15:46:51 CET

Greg Hudson wrote:
>> const apr_off_t min = (apr_off_t) 1 << ((sizeof (apr_off_t)*8)-1);
>
> The behavior of this expression is undefined by C99. If we're going
> to rely on common signed overflow behavior, "if ((apr_off_t) *offset
> == *offset)" would appear to be simpler.

Much simpler!

> I'm not sure if there's a good way to perform this check which is
> totally standards-conformant. C99 allows two's-complement,
> one's-complement, and sign-and-magnitude representation of integers.

Well, I did ask whether it was ok to assume 2's complement when I first
posted the code here:

http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=54782

Which reminds me, Ben, that you didn't answer my question at the bottom of
that post. The one about whether the *apr_offset value can be manipulated.

- Russ

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

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