C++ Logo

SG12

Advanced search

Subject: Re: [ub] C provenance semantics proposal
From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2019-04-04 15:58:02


[Jens]
| It seems to me that most of the introductory examples have clear
| answers in current C++. In particular:
|
| — If one pointer represents the address of a complete object, and another
| pointer represents the address
| one past the last element of a different complete object, the result of the
| comparison is unspecified.
|
| The proposal in N2362 seems to make such a comparison yield "true".
|
| I actually like our current rule: never ever compare / subtract pointers
| to different complete objects. If you must compare, use std::less.

+1.

-- Gaby


SG12 list run by herb.sutter at gmail.com