C++ Logo

std-proposals

Advanced search

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

From: Filip <fph2137_at_[hidden]>
Date: Fri, 31 Jan 2025 12:02:49 +0100
Giuseppe D'Angelo
You’ve got a point with this but shouldn’t it be left to the programmer to know what they’re accessing?

Maybe a simple syntax should be introduced to help with semi-automatic checking if object is dereferencable?
‘’’
try return ptr.innerStruct.member;
else return defaultValue;
‘’’

Which could be sugar syntax checking if everything being accessed by ‘.’ Operator is dereferencable?
Possible done like you would normally with if statements?

Marcin Jaczewski
Maybe it wouldn’t be a bad thing to allow people to use ‘->’ on objects and for plain pointers it would only be syntactical sugar?

Operator overload should still be accessible or alternatively the use of ‘.get()’ for those opposed heavily to the arrow?

Cheers, Filip

> Wiadomość napisana przez Giuseppe D'Angelo via Std-Proposals <std-proposals_at_[hidden]> w dniu 31 sty 2025, o godz. 11:37:
>
> Giuseppe D'Angelo

Received on 2025-01-31 11:03:05