Date: Sun, 24 Aug 2025 16:04:22 -0400
On Sun, Aug 24, 2025 at 3:27 PM organicoman via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
>
>
> >> Anyone who is able to check their pointers before use, is equally able
> >> to assign 0 to deleted pointers.
> >
> > {
> > T* p = new T;
> > Dll_fn_takes_by_Copy (p);
> > delete p;
> > }
> >
> > Show me how.
> >
> >
>
> Now you are being silly.
>
> 😂 ...no seriously...it is a honest question.
> How can check if Dll_fn_takes_by_Copy assigned nullptr to the copy of p?
If a function takes a parameter by copy, then it has chosen to take it
*by copy*. You can't make it take a parameter by reference. If a
function wants to take a copy and modify that copy, you don't get to
know that this has happened.
Nothing you are proposing will magically turn `Dll_fn_takes_by_Copy`
into `Dll_fn_takes_by_Reference`.
> > But library implemented and low level will definitely use raw
> > pointers....just show me how many std::vector implementation uses smart
> > pointers for its internal data pointer.
> >
>
> How standard library implementations are written is totally irrelevant.
>
> Very relevant...stl implementation are the goto to anyone who wants to crank up his level of C++ expertise. Most students i see, copy the standard implementation, even if they have the tools to do better.
If that's the case, you need to get these students to stop doing that.
Standard library implementations are not learning guides.
<std-proposals_at_[hidden]> wrote:
>
>
>
> >> Anyone who is able to check their pointers before use, is equally able
> >> to assign 0 to deleted pointers.
> >
> > {
> > T* p = new T;
> > Dll_fn_takes_by_Copy (p);
> > delete p;
> > }
> >
> > Show me how.
> >
> >
>
> Now you are being silly.
>
> 😂 ...no seriously...it is a honest question.
> How can check if Dll_fn_takes_by_Copy assigned nullptr to the copy of p?
If a function takes a parameter by copy, then it has chosen to take it
*by copy*. You can't make it take a parameter by reference. If a
function wants to take a copy and modify that copy, you don't get to
know that this has happened.
Nothing you are proposing will magically turn `Dll_fn_takes_by_Copy`
into `Dll_fn_takes_by_Reference`.
> > But library implemented and low level will definitely use raw
> > pointers....just show me how many std::vector implementation uses smart
> > pointers for its internal data pointer.
> >
>
> How standard library implementations are written is totally irrelevant.
>
> Very relevant...stl implementation are the goto to anyone who wants to crank up his level of C++ expertise. Most students i see, copy the standard implementation, even if they have the tools to do better.
If that's the case, you need to get these students to stop doing that.
Standard library implementations are not learning guides.
Received on 2025-08-24 20:04:34