[ub] C provenance semantics proposal

David Vandevoorde daveed at edg.com
Thu Apr 11 00:35:56 CEST 2019



> On Apr 10, 2019, at 6:28 PM, Jens Maurer <Jens.Maurer at gmx.net> wrote:
> 
> On 11/04/2019 00.06, Jens Gustedt wrote:
>> Hello Jens,
>> 
>> On Wed, 10 Apr 2019 23:40:37 +0200 Jens Maurer <Jens.Maurer at gmx.net>
>> wrote:
>> 
>>>> Inter-object equality comparison has to be supported,
>>> 
>>> "Supported" in the sense of "getting a well-defined, stable answer",
>>> I presume. Why do you need that?
>> 
>> Because this is all that pointer equality is about.  I have to be able
>> to compare pointers to whatever objects for equality. If I can only
>> use it for pointers for which I know that they point to the same
>> object, I don't a need a `==` operator in the language :)
> 
> Not quite.  It does make sense to compare pointers to subobjects
> within the same larger object, e.g.
> 
> int a[100];
> bool b = &a[5] == &a[6];
> 
> where, of course, the pointers may come from more involved
> pointer arithmetic.
> This is supported and well-defined in the status quo, I presume,
> and nobody is suggesting to change that.
> 
> So, there is a use and need for == on pointers even if you can't
> compare pointers to arbitrary objects.
> 
> So, again, why do you need to compare pointers to arbitrary
> objects?

For hash tables where the keys are pointers to objects?

	Daveed



More information about the ub mailing list