[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 5310: find_top_context () maintenance (issue 341150043 by addr

From: nine . fierce . ballads
Subject: Re: Issue 5310: find_top_context () maintenance (issue 341150043 by address@hidden)
Date: Wed, 25 Apr 2018 16:05:08 -0700

On 2018/04/25 10:44:22, dak wrote:

Please note that all of your proposals so far do _not_ provide the
information that you value in any manner: previously undefined
behavior would
continue to be undefined behavior and would just look differently.

Yes, but what I believe you are overlooking is the value to the reader.
If a developer explicitly constructs a sure_ptr<> (or whatever) without
checking that the pointer he is providing is not null, the blame for
undefined behavior is easy to place.  The intent is clear that such a
pointer should not be null, so the failure to check before construction
is what needs to be fixed.

With raw pointers, when faced with code like
get_something(x)->do_something_with_it(...), it can require a lot more
effort to satisfy oneself that the person who wrote it was justified in
not checking whether the result of get_something(x) is null.  Worse,
maybe it was fine at the time, but someone goes and changes
get_something(x) so that it can return null rarely enough that nobody
notices for a while.

Either way, to make this work at all in a mechanical manner, you need
to be
consistent in the value creation chain. . . . Every further use must
retain this particular type, not allowing for a piecemeal conversion
of the code

Now you're speaking my language.

It still has the disadvantage of adding a new class as baggage, making
it harder
for newcomers interpreting code.  In particular the necessity of
overloading *,
&, and -> operators raises the amount of knowledge required for
maintenance and
debugging.  I am rather doubtful that this would be a good tradeoff so
I would
not want to encourage you to indulge in a significant amount of work
here which
I may not want to see added to the code base after all.

If you're at least open to reviewing something concrete, I'll put
something together, but not today.  Thanks for your time so far.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]