C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Similar to [[no_discard]], but store in a variable, maybe call it [[must_store]]

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 22 Jul 2025 16:13:48 +0200
It is not something you can solve with 3 questions on this mailing list and a bit of bike-shedding on top.   It is a task worthy of 5-10 PhD theses. (not saying one person cannot solve it).   And some are trying.   -----Ursprüngliche Nachricht----- Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Di 22.07.2025 16:01 Betreff:Re: [std-proposals] Similar to [[no_discard]], but store in a variable, maybe call it [[must_store]] An:std-proposals <std-proposals_at_[hidden]>; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>; On Tue, Jul 22, 2025 at 2:18 PM Peter Bindels wrot:e: > > how do you like the name "lifetimebound" instead? Yeah I'd be OK with [[lifetimebound]] or maybe one of these: 1. [[generates_temporary_handle]] 2. [[lifetime_bound]] 3. [[temporary_handle]] 4. [[object_lifetime_handle]] 5. [[handle_lifetime_bound]] 6. [[dependent_lifetime]] 7. [[transient_handle]] 8. [[lifetime_limited]] I wonder should we limit it to return values? I mean sometimes we have functions like this:    bool MyClass::SomeMethod(   Handle &p  ); The programmer passes an uninitialised handle to 'SomeMethod', and then the handle gets set by 'SomeMethod', like this:    bool MyClass::SomeMethod(   Handle &p  )    {        static Handle h = 0u;        p = ++h;        return p != std::numeric_limits<Handle>::max();    } -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-07-22 14:23:31