4 ms·
Will it? Rust has editions which C++ does not have which seems like a potentially significant mitigation.
by binarycrusader 5y ago
Will it? Rust has editions which C++ does not have which seems like a potentially significant mitigation.
- otabdeveloper4 5y agoHow are "editions" any different from C++ standards versions?
- steveklabnik 5y agoStandard revisions are like snapshots in time. Editions are a way of introducing surface-level changes into the language, which are guaranteed to interoperate. Most features land in as many editions as possible simultaneously, the edition differences are purely the things that would be breaking changes, and so require you to opt into which ones you want. Both strategies have advantages and disadvantages.
- IAmLiterallyAB 5y agoYou can use new features from new Rust versions/compilers on old editions, as long as the new features don't require backwards incompatible changes. You can't use features from new C++ standards when targeting an older standard.
- snovv_crash 5y agoYou can, they just often live in somewhere like std::experimental
- ben0x539 5y agoEditions are opt-in at a per-package level. You can write Rust 2015 code that wouldn't be valid Rust 2018 because of breaking changes, while using libraries that use Rust 2018.
- est31 5y agoLinking different C++ releases together is kinda possible in C++ too: https://stackoverflow.com/a/49119902 https://stackoverflow.com/a/49119902 For GCC it is safe to link together any combination of objects A, B, and C. If they are all built with the same version then they are ABI compatible, the standard version (i.e. the -std option) doesn't make any difference. Ignore the part of the link where it talks about gotchas with linking together binaries made by different compiler versions because in Rust this case isn't supported at all.
- ben0x539 5y agoRight, I knew I should have said "without shenanigans". The difference is that editions are a first-class, supported mechanism for managing interoperability between code targeting different "standards versions". It's not up to the user and the linker to conspire so that things work out, it's part of the language, and you don't need to limit your public interfaces / generic code to the lowest version. (I don't know if this is the best policy? It seems like it could be a big burden on implementations in the long run.)
- nickysielicki 5y agoWithout a formal recognition of this (ie: editions) you can have horrible silent ABI breakage in C++. See this Jason Turner video: https://youtu.be/By7b19YIv8Q https://youtu.be/By7b19YIv8Q