News for hackers. Stuff that matters.
Re:My Most Important C++ Aha Moments (2006) by pjmlp on Sunday June 26, 2016 @02:06PM (#11981835)
> Where is this modern C++ culture that has resulted in large-scale codebases free of memory safety vulnerabilities?

In any large scale C++ conference like CppCon.

In tooling from Microsoft and Apple.

> I haven't seen any evidence for this. A lot of vulnerabilities are found in modern C++11.

Using C++11 idioms, or C with classes?

> I don't see any way that the C++ Core Guidelines are going to be able to succeed in creating a usable language that is memory-safe. Robert O'Callahan and I have elaborated why in other posts.

Rust will become a sound alternative to C++ when:

- Libraries stop using nightly

- Rust developers can call OS APIs like COM on Windows without gymnastics. I mean with the same ease that Delphi, C++ Builder and Visual C++ integrate with COM.

- Rust developers can call OS X and iOS APIs with the same ease than Swift and Objective-C

- Has IDE support that can match what QtCreator, Clion, XCode, Visual Studio, C++ Builder, Keil MDK, ...

I really would like to see Rust one day supersede C++, but in what concerns C family of the languages, C++ is the safest option we currently have.

I have been part of the C++ community since the early days as Turbo Pascal and strong type refugee, and have followed how hard it has been for a language that is almost copy-paste compatible with C to earn the position it holds in the industry.

So until Rust gets some OS SDK love, bashing C++ community efforts to improve security won't get many adopters.

I keep on playing with Rust, but I get to write production code it still is JVM, .NET languages, Swift or C++.

Re:My Most Important C++ Aha Moments (2006) by pcwalton on Sunday June 26, 2016 @02:37PM (#11982010)
> In any large scale C++ conference like CppCon.

> In tooling from Microsoft and Apple.

Microsoft and Apple regularly ship memory safety vulnerabilities in their codebases that are written in modern C++. Their browser engines, for example.

> Using C++11 idioms, or C with classes?

Using C++11 idioms. C++11 doesn't actually do anything to mitigate use after free, for example. In fact, I think there's a reasonable argument to be made that C++11 is less safe than C++03 in terms of use after free, because of features like move semantics and lambdas.

And I'm not intending to argue "use Rust" here. There are plenty of other memory safe languages out there. I'm simply arguing that C++ is not memory safe, and it cannot be while preserving any semblance of backwards compatibility. The specific technical reasons for this have been elaborated in posts that I've sure you've seen. I'd like to see proponents of the idea that modern C++ is memory safe actually try to rebut those.

Re:My Most Important C++ Aha Moments (2006) by pjmlp on Sunday June 26, 2016 @04:24PM (#11982507)
The issue is not that C++ is 100% memory safe language, it is not.

Personally I would rather be using Ada or Modula-3 for the few use cases I still use C++.

However in the context of security minded developers that can only choose between C, Objective-C, C++ and nothing else, C++ is the only one providing the features to write safer code.

Of course if not all team members play ball it doesn't work, but it is better than not having an option at all.