C++ Logo


Advanced search

Subject: Re: Should std::atomic<T*> have operator->?
From: Thiago Macieira (thiago_at_[hidden])
Date: 2019-10-22 00:05:32

On Monday, 21 October 2019 10:33:02 PDT Andrey Semashev via Std-Discussion
> I don't think the compiler can ever prove that the pointer is not
> accessed by any other threads or signal handlers. Even in case of LTO,
> the compiler can't be sure external threads spawned by OS or shared
> libraries or signal handlers don't modify the atomic pointer.

Sometimes it can

void f()
    std::atomic_ptr<MyType> ptr = get_object();

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups