C++ Logo

sg12

Advanced search

Re: [ub] C provenance semantics proposal

From: Gabriel Dos Reis <gdr_at_[hidden]>
Date: Thu, 4 Apr 2019 20:58:02 +0000
[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

Received on 2019-04-04 22:58:07