|
|
Subscribe / Log in / New account

Herb Sutter on increasing safety in C++

Herb Sutter on increasing safety in C++

Posted Mar 18, 2024 14:42 UTC (Mon) by pizza (subscriber, #46)
In reply to: Herb Sutter on increasing safety in C++ by mb
Parent article: Herb Sutter on increasing safety in C++

> In Rust you almost never trade safety for speed. That's not how Rust works.

Incorrect; the fact that this code is explicitly conformant with the language shows that Rust does indeed work this way.

If the programmer wants to do something "unsafe" to gain some speed (or any other reason!) then they are free to do so. It is, after all, their own code.

....congratulations, Rust is finally beginning to have to grow up and face the harsh fact that in the real world, developers will write crappy [1] code that violates any number of "cultural norms" or "best practices" [2] and there is *nothing* that can be done about it!

Rust-the-project has no legal (or moral!) ability to ostracize or otherwise exclude anyone from writing software in Rust, putting it online with a warranty disclaimer, and random third parties incorporating/using it. After all, that's how Rust itself continues to exist. Indeed, any exclusionary actions will likely lead to some expensive legal trouble.

[1] in the eye of the beholder
[2] The parallels here with TFA's "voluntary practices to improve safety in C++" are richly ironic


to post comments

Herb Sutter on increasing safety in C++

Posted Mar 18, 2024 15:02 UTC (Mon) by khim (subscriber, #9252) [Link]

> ....congratulations, Rust is finally beginning to have to grow up and face the harsh fact that in the real world, developers will write crappy [1] code that violates any number of "cultural norms" or "best practices" [2] and there is *nothing* that can be done about it!

Except the whole discussion started with example which directly contradicts your assertion.

Yes, developers will write crappy code, but that's not a problem by itself. It only becomes a problem when crappy code becomes popular and is starting to affect other people while developer ignores the issue. And that can be fixed. It was done pretty successfully, or else we wouldn't have had this discussion at all.

> Indeed, any exclusionary actions will likely lead to some expensive legal trouble.

Seriously? When was Kim reinstated as the lead of Actix-web and his opponents were sent to jail?

> Rust-the-project has no legal (or moral!) ability to ostracize or otherwise exclude anyone from writing software in Rust, putting it online with a warranty disclaimer, and random third parties incorporating/using it.

Indeed. But that doesn't mean that “nothing can be done”, as you assert. People are people, they find a way to achieve their goals. And if simple and obvious way doesn't work they find a roundabout way.

Herb Sutter on increasing safety in C++

Posted Mar 18, 2024 15:10 UTC (Mon) by Wol (subscriber, #4433) [Link]

> ....congratulations, Rust is finally beginning to have to grow up and face the harsh fact that in the real world, developers will write crappy [1] code that violates any number of "cultural norms" or "best practices" [2] and there is *nothing* that can be done about it!

And the assumption that "users of Rust" are "members of the Rust community" is tenuous, in itself ...

> [2] The parallels here with TFA's "voluntary practices to improve safety in C++" are richly ironic

The important thing with Rust - and what the REAL Rust community presumably say - is that you cannot write unsafe code BY ACCIDENT.

Either (a) you have to wrap your own code in "unsafe" markers, or (b) you should KNOW whether or not you trust other peoples' code you're importing. Assuming the library author isn't lying (and in general, why should they) then you should KNOW whether their code contains unsafe blocks, and more importantly WHY.

After all, if it's acceptable to call out to C/C++, surely a bit of unsafe Rust is a drop in the ocean :-)

Cheers,
Wol


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds