[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: intptr_t vs. uintptr_t
From: |
Paul Eggert |
Subject: |
Re: intptr_t vs. uintptr_t |
Date: |
Fri, 13 Dec 2019 19:19:46 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 |
On 12/13/19 6:35 PM, Bruno Haible wrote:
> "Prefer intptr_t for internal representations of pointers"
>
> I disagree with this advice. uintptr_t ought to be used for representing the
> address of a pointer.
It depends on the application. For example, with two char * pointers P and Q
into an array, it can be helpful that P - Q yields the same integer as
((intptr_t) P - (intptr_t) Q), assuming the usual representation. That's not
true for uintptr_t.
In practice, Emacs uses uintptr_t quite a bit for things like hashes and tags;
but it uses intptr_t a bit more, so the advice seems reasonable for Emacs.
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, Paul Eggert, 2019/12/11
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/12
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/12
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/12
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, Paul Eggert, 2019/12/12
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/13
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/13
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, Jim Meyering, 2019/12/13
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, Paul Eggert, 2019/12/13
- Re: intptr_t vs. uintptr_t, Bruno Haible, 2019/12/13
- Re: intptr_t vs. uintptr_t,
Paul Eggert <=
- Re: intptr_t vs. uintptr_t, Bruno Haible, 2019/12/14
- Re: intptr_t vs. uintptr_t, Paul Eggert, 2019/12/14
- Re: intptr_t vs. uintptr_t, Bruno Haible, 2019/12/14
- Re: intptr_t vs. uintptr_t, Paul Eggert, 2019/12/16
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/15
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, Paul Eggert, 2019/12/16
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/16
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, Paul Eggert, 2019/12/19
- Re: bug#34951: [PATCH] grep: a kwset matcher not work in a grep matcher, arnold, 2019/12/20