Live data from Hacker News

Deprecating Raw Pointers in C++20

bfilipek.com

11–20 of 84 posts

Re: Deprecating Raw Pointers in C++20

#11
I hope this is a joke: the std::weak_ptr / std::shared_ptr combo (only non-reference alternative I can think of other than std::optional) can have pretty bad performance implications due to ref-counting atomics in multi-threaded scenarios...

For the use-case of optional pointers that don't have any ownership (and can possibly be updated mid-lifetime) and have a guaranteed external lifetime, what's the alternative?

Are there any other ways of doing this that are guaranteed to have no performance (time or memory) overhead in modern C++ (relying on by-value move semantics isn't ideal) ?

Also, what about std:atomic (CAS) raw pointers - for high-performance / lockless stuff, they can be critical...

Re: Deprecating Raw Pointers in C++20

#12

Can someone with more knowledge about c++ standard comment whether this is for real or it is an April Fools joke. Wouldn't this be an enormous change and probably break the language?

It would break the C interface unless the spec had some kind of wrapper for such cases.

Re: Deprecating Raw Pointers in C++20

#13
post #6

The fact that this headline cannot be distinguished from April Fools joke by other commenters seems to say a lot about the direction in which C++ standard committee is heading.

If i didn't read this comment section, i would've been convinced it's real.

Re: Deprecating Raw Pointers in C++20

#14
This could be a joke. Or not.

It is very much in keeping with the current direction of C++, which appears to be:

"Oh no, C++ cannot keep pace with modern systems languages, let's repair it by whatever means possible"

Their heart is in the right place, but perhaps this accelerated process of mutating the language will ultimately be what kills it.

Personally, after having deep expertise in C++(11/14) I jumped ship to Go and will _never_ look back...

Re: Deprecating Raw Pointers in C++20

#15

Can someone with more knowledge about c++ standard comment whether this is for real or it is an April Fools joke. Wouldn't this be an enormous change and probably break the language?

It seems to be a joke, they would have serious problem with backward compatibility with "this" pointer. Also it would limit the use cases for the language, unless they would introduce something like std::raw_ptr, which to be honest would be quite funny.

Re: Deprecating Raw Pointers in C++20

#16
I guess a serious point is that modern C++ does "deprecate" raw pointers in the sense that their use is discouraged outside of interfacing with external libraries or old C++ code.

But that's more the realm of linters than compiler warnings.

Re: Deprecating Raw Pointers in C++20

#18

Can someone with more knowledge about c++ standard comment whether this is for real or it is an April Fools joke. Wouldn't this be an enormous change and probably break the language?

If it were for real how would you implement smart pointers?

In C obviously or you know, in inline assembly since it seems that it isn't going anywhere. But joking aside they could be implemented by the compilers similar to how std::function is implemented today.

Re: Deprecating Raw Pointers in C++20

#19
post #18

Earlier quoted context omitted.

If it were for real how would you implement smart pointers?

In C obviously or you know, in inline assembly since it seems that it isn't going anywhere. But joking aside they could be implemented by the compilers similar to how std::function is implemented today.

There is no magic in std::function Implementation. std::initializer_list, on the other hand needs some magic from the compiler.

Re: Deprecating Raw Pointers in C++20

#20
post #6

The fact that this headline cannot be distinguished from April Fools joke by other commenters seems to say a lot about the direction in which C++ standard committee is heading.

maybe HN should have a colored header line to remind people about this day and prevent reactions

The entire point of April Fools is to fool people...
Post reply on HN