[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: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2004-01-17 06:07:19 CET

> 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.

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.
It would be nice if APR would help us out by defining *_MIN and *_MAX
constants for apr_off_t, but it doesn't; moreover, it looks like it
would have a difficult job doing so, since there are apparently no
system constants for the minimum or maximum off_t value.

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

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