This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] Let libelf.h's loff_t fall back to off_t
- From: Josh Stone <jistone at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 09 Oct 2015 17:19:20 -0700
- Subject: Re: [PATCH] Let libelf.h's loff_t fall back to off_t
On 10/09/2015 02:57 PM, Roland McGrath wrote:
>> However, I'm afraid to change signedness, if only because -1 is used in
>> error conditions, e.g. returned from elf_update(). Someone checking <0
>> will be in for a bad time.
> Yeah, that sounds like a wise fear. But maybe Elf64_Off is OK (and
> preferable even) for the cases that are not return values?
In practice we're limited to 2^63-1 off_t anyway, so the only benefit
would be enforcing that they can't be negative, right?
I dunno, seems like a small benefit that still has a chance to perturb
users. Even just say Elf_Data.d_off comparisons may lead to "comparing
signed and unsigned" warnings if we change our part, and I know I like
-Werror in my builds.
>> How about just int64_t? We already pull stdint.h for elf.h, so it seems
>> fine to include and use that in libelf.h too.
> Sold! We already have <sys/types.h> which covers <stdint.h> too. But we
> only ever had that for off_t/loff_t, so just change it to <stdint.h> and
> use int64_t.
I'll just do this for now.