Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: jameskuyper@xxxxxxxxxxx
- Date: Mon, 31 Dec 2007 09:30:29 -0800 (PST)
Joe Wright wrote:
Ulrich Eckhardt wrote:
Richard Tobin wrote:You presume the first expression (4) will be evaluated before the last
In article <5truv2F1f3un6U1@xxxxxxxxxxxxxxxxx>,
Ulrich Eckhardt <doomster@xxxxxxxx> wrote:
Casting the expression won't help, if it's already overflowed as anlseek64(fd, 4*1024*1024*1024, SEEK_SET) // integer overflowOthers already explained what is happening, but I'd suggest another
approach that works without C99's long long type simply cast the
expression to off_t, which will automatically be the correct 64 bit type,
regardless of whether you use C89 or C99.
int.
Argh, well caught. Casting the first constant in above expression does the
job though.
Uli
(1024). Why?
He is making no assumptions about the order of evaluation of the
numeric literals. His statement is based upon the assumption, mandated
by the C grammar, that the multiplication expressions be evaluated in
order from left to right. It is those multiplications that require
type conversions, where needed to bring both sides to a common type,
and making sure that the first multiplication involves an operand that
is large enough to store the final result is sufficient to ensure that
all of the calculations are performed without overflow.
.
- References:
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: Ulrich Eckhardt
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: Richard Tobin
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: Ulrich Eckhardt
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: Joe Wright
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Prev by Date: Re: Redirect stdin ?
- Next by Date: Re: Redirect stdin ?
- Previous by thread: Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Next by thread: [COMMERCIAL] Help required - www.progforent.com
- Index(es):
Relevant Pages
|