C++ Logo


Advanced search

Subject: Re: [std-proposals] Allow '.' to behave like '->' where it is currently an error.
From: Olaf van der Spek (ml_at_[hidden])
Date: 2020-02-29 01:20:31

On Thu, Feb 27, 2020 at 3:32 PM J Decker <d3ck0r_at_[hidden]> wrote:
> On Thu, Feb 27, 2020 at 4:00 AM Olaf van der Spek via Std-Proposals <std-proposals_at_[hidden]> wrote:
>> On Fri, Feb 21, 2020 at 9:12 AM Михаил Найденов via Std-Proposals
>> <std-proposals_at_[hidden]> wrote:
>> > For C++ the value is indeed possibly negative, as this will literally promote using raw pointers because their special properties.
>> >
>> > we try to promote
>> >
>> > something(const object& o);
>> > instead of
>> > something(const object* o);
>> Wouldn't a better solution be for C to adopt references?
> Not really, because to pass the first one you'd have to have an instance defined on the stack, and couldn't use a pool of objects; perhaps that object has a complex construction....
> You can't save a reference for later.. struct { int &a; }s;
> references project data from 'here' to 'there', I really just want to work with data where it is; (probably 'there' because the caller didn't directly create it).

object* p = ...;

No stack instance required and you can save references for later. p
shouldn't be NULL though.


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups