4 ms·
Is there a compiler option in C++ to only allow this safe variant of the language to be used? I find this argument to be a false comparison to the features of R
by bluejekyll 10y ago
Is there a compiler option in C++ to only allow this safe variant of the language to be used? I find this argument to be a false comparison to the features of Rust, especially on dataraces, etc. I've never seen a 100% clean, modern C++ codebase. If you know of one, could you point us to it?
Also, this is just me, given experience writing code in C++ and Rust, I find Rust to be a more ergonomic language (YMMV).
- deleted 10y ago[deleted]
- ericpts 10y agoYou can try to use some extra tools that clang provides, such as the static analyzer ( https://clang-analyzer.llvm.org/ https://clang-analyzer.llvm.org/ ) or tidy ( http://clang.llvm.org/extra/clang-tidy/ http://clang.llvm.org/extra/clang-tidy/ ) with checks like the cppcoreguidelines.
- pjmlp 10y agoAnd what do you do when clang isn't an option, due to customer, target hardware, OS or even language extensions? This is what I mean in another thread about outsourcing safety.
- otabdeveloper 10y ago> And what do you do when clang isn't an option, due to customer, target hardware, OS or even language extensions? Then you cannot use Rust and must settle for lack of safety. (A profoundly silly question -- if modern C++ is not an option for whatever reason, then Rust is doubly so.)
- pjmlp 10y agoOnly when people mix languages with implementations. Just because the only existing Rust compiler uses LLVM, it doesn't mean another implementations will not surface. So hypothetical the OS not targeted by clang, can still have a Rust compiler on the OS SDK, offering all safety guarantees from Rust. For example, there are OSes and hardware architectures not supported by clang that have Ada and even Java AOT compilers.
- lossolo 10y agoYou made a bad argument, hide your ego in your pocket and admit it instead of writing such a nonsense. Both clang and Rust compiler are based on LLVM and they both can target only those platforms that LLVM target. If you can't use clang today then you can't use Rust also. We are not talking about "hypothetical" situations or alternative worlds because in those situations i can say whatever I want about clang also...
- pjmlp 10y agoNonsense only to those that don't understand about compiler design. If you want an option that works today without nonsense as you put it, then I would pick Ada over C++ for secure critical projects in such scenarios. Companies like LDRA do exist, because just using clang isn't enough. http://www.ldra.com/en/software-quality-test-tools/group/by-coding-standard http://www.ldra.com/en/software-quality-test-tools/group/by-... Also a reason why HIC exists http://www.codingstandard.com/ http://www.codingstandard.com/
- lossolo 10y agoYou didn't even reply to what I wrote? We are talking about Rust and Clang compilers and platforms they target and this was the context. It started when you tried to belittle Clang because it shows warnings and then you tried to make argument about hypothetical Rust compiler that can target OS that Clang can't, again trying to show Rust > C++. Even if you can't show superiority of Rust over C++ you are inventing hypothetical compilers that you think will work as your argument. If anyone will read your comments then he can see you are obviously biased and your ego just magnifies that effect. Think about it, objectively, get some air, there is world besides HN also.
- krona 10y agoVisual Studio 2017 has built-in support for C++ Core Guidelines static analysis suite. more info: https://blogs.msdn.microsoft.com/vcblog/2016/10/12/cppcorecheck/ https://blogs.msdn.microsoft.com/vcblog/2016/10/12/cppcorech...