News for hackers. Stuff that matters.
Re:Embracing Modern C++ Safely, Book Review by Koshkin on Monday May 30, 2022 @04:41PM (#31563416)
There's nothing wrong with using a raw pointer as an argument of a function. In this context this is usually equivalent to using a reference. What is wrong, in fact, is passing, instead, a unique pointer (by reference, necessarily) or, even worse, a shared pointer (by value) when there is no need for sharing.
Re:Embracing Modern C++ Safely, Book Review by PaulDavisThe1st on Monday May 30, 2022 @11:22PM (#31565803)
> In this context this is usually equivalent to using a reference.

Not really. The very, very, very important difference is that the pointer can be null, signalling "no object". For some purposes, this is a critically important difference; in other cases, you should be passing a reference.