C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Possible deprecation of -> operator

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Sun, 02 Feb 2025 14:32:23 +0300
On February 2, 2025 12:39:45 PM J Decker via Std-Proposals
<std-proposals_at_[hidden]> wrote:

> On Sun, Feb 2, 2025 at 1:04 AM Jonathan Wakely <cxx_at_[hidden]> wrote:
>
>>
>> this doesn't affect smart pointers, since '.' already has a well defined
>>> behavior... it's a nothing-burger for you anyway; and would just be part of
>>> compatibility with C' (extending '.' to look at the left type).
>>
>> I'm not sure what you're trying to say. If -> is not used for pointers,
>> but is still used for smart pointers and std::optional etc then you haven't
>> really simplified anything. Just created inconsistency where there was
>> consistency before.
>
> I understand this viewpoint; but in having accepted '.' (in a post '.'
> derefercing pointer view) it is a consistent behavior to access a member of
> an object rather than 2 methods. Just because idomatic C++ doesn't get the
> same benefit of 'consistency' now that you mention these things, seems
> unfair to keep others from having it...

Are you suggesting to make this change in C but not in C++? If so, this is
probably the wrong list to discuss this in, but it would definitely hurt
compatibility between the languages for what seems to be nonexistent benefit.

> but then who besides me maintains C
> that is also C++ compilable? Do we/should we really even care about
> compatibility?

Nearly every C library is usable in C++ through interface. Mixing C and C++
this way is *very* common.

Received on 2025-02-02 11:32:27