Live data from Hacker News

Deprecating Raw Pointers in C++20

bfilipek.com

21–30 of 84 posts

Re: Deprecating Raw Pointers in C++20

#21
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.

Inline assembly isn't standard C or C++ though?

Re: Deprecating Raw Pointers in C++20

#23

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 G…

There is nothing in C++ 11 and later that is forced on you. Everything that was added is optional. For personal projects I depend on some alternate implementations for things that are now in the STL because these not complete enough for my needs.

Re: Deprecating Raw Pointers in C++20

#24
post #18

Earlier quoted context omitted.

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.

Inline assembly isn't standard C or C++ though?

But still can be (and is) used to implement some features from the standard library.

Re: Deprecating Raw Pointers in C++20

#25
post #18

Earlier quoted context omitted.

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.

Inline assembly isn't standard C or C++ though?

It is pseudo standard in C++.

Meaning ANSI C does not refer at all to inline Assembly, from its point of view it does not exist.

ANSI C++ on other hand, specifies the asm keyword and that it should enable a compiler specific way to write inline Assembly.

But yeah, neither of them actually specifies how it should look.

Re: Deprecating Raw Pointers in C++20

#28
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.

It’s not like the idea is completely crazy; pointer misuse is a big source of all kinds of problems, Rust shows how much can be done without constantly using raw pointers, and what are the C++ Core Guidelines if not an effort in exactly this direction?

I finally “got” that this is a joke when they discussed the future alternatives:

> For copyable and assignable references you can use std::reference_wrapper. (http://en.cppreference.com/w/cpp/utility/functional/referenc...)

and thought, ha ha, an “assignable reference” instead of a “pointer”, that’s obviously completely different. :) What a subtle joke!

Only now I see that reference_wrapper is apparently completely real and exists since C++11. Why does this even exist? My head hurts from banging it against the desk.

Re: Deprecating Raw Pointers in C++20

#29
post #18

Earlier quoted context omitted.

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.

Inline assembly isn't standard C or C++ though?

There have always been library features in the C and C++ standards that can't be implemented using standard C or C++. setjmp and longjmp would be the obvious examples.

Re: Deprecating Raw Pointers in C++20

#30
post #28
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.

It’s not like the idea is completely crazy; pointer misuse is a big source of all kinds of problems, Rust shows how much can be done without constantly using raw pointers, and what are the C++ Core Guidelines if not an effort in exactly this direction? I finally “got” that this is a joke when they discussed the future alternatives: > For copyable and assignable references you can use std::reference_wrapper. ( http://…

It probably exists facilitate type parametrization of pointer implementations. Just a guess.

That still crazy though :)

Post reply on HN