C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Safety checks at compile time

From: Phil Bouchard <boost_at_[hidden]>
Date: Tue, 14 Feb 2023 17:08:22 -0500
On 2/14/23 17:04, Edward Catmur via Std-Proposals wrote:
> On Tue, 14 Feb 2023 at 15:59, Chris Ryan <chrisr98008_at_[hidden]
> <mailto:chrisr98008_at_[hidden]>> wrote:
>
> The owner object's operator[] (with bounds checking) returns the
> reference to the indexed object.
> The owner object should not return a raw pointer to the head and
> allow somebody else to index off of it.
>
>
> You appear to be talking about a fairly extensive change to the
> Standard. Note that various Library components added data() member
> functions relatively recently; are you saying that was a mistake?
>
> And are you saying that any component that has API returning a raw
> pointer is to be considered unsafe? There wouldn't be much left of the
> Library if all such components were barred from use.

To interject to the conversation, C++ doesn't make the difference
between a pointer and an iterator. A pointer "owns" a memory block but
an iterator doesn't.

I already abstracted this in:
https://github.com/philippeb8/root_ptr/blob/master/include/boost/smart_ptr/root_ptr.hpp


-- 
Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon
<https://www.linkedin.com/in/phil-bouchard-5723a910/> 
CTO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
8 rue de la Baie| Gatineau (Qc), J8T 3H3 Canada
Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi que les
documents l'accompagnant, sont destinés uniquement aux personnes
identifiées et peuvent contenir des informations privilégiées,
confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce
message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named
recipients only and may contain privileged or confidential information
which is not to be disclosed. If you received this communication by
mistake please destroy all copies.

Received on 2023-02-14 22:08:23