This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: sysdeps/unix/sysv/linux/lseek.c on ILP32 question
On Feb 21 2017, Steve Ellcey <sellcey@caviumnetworks.com> wrote:
> OK, I see if I change:
>
> val = lseek(fd, -(sizeof(crmsg) - 1), 1);
>
> to
>
> val = lseek(fd, -((off_t) sizeof(crmsg) - 1), 1);
>
> I get the result I want.
>
> But I am not entirely sure why, I guess it is a question of exactly how
> integer conversions are done.
size_t is unsigned, and -size_t is still a positive value.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."