Hacker News new | ask | show | jobs
by moregrist 956 days ago
Please define “normal”. Normal C++ for me runs the gamut of looking a lot like C to be a template metaprogramming monstrosity.

Almost all C++ code interacts with bare pointers at some point. And that’s just one of the places where you get into issues with safety.

You can also run into problems with iterators being invalidated: your iterator into a std::vector is no longer valid after a call to push_back().

Anything that stores a reference and can exist after the lifetime of the object, really. Lambdas are a problem here. But so are instances with reference members.

C++ is littered with these things.

1 comments

> Almost all C++ code interacts with bare pointers at some point.

This is a device driver. If it has to talk to memory-mapped hardware, that's a raw pointer, inherently, inevitably.

Other things are language issues, and can be solved by changing languages, but raw pointers are inherent in the task.

> This is a device driver. If it has to talk to memory-mapped hardware

This is an IPC "device driver". It does not talk to any hardware, it's used to pass messages between processes.

> This is a device driver.

It's not, it's an IPC subsystem. It doesn't talk to any hardware.