Re:Const vs. constexpr vs. consteval vs. constinit in C++20
by JonChesterfield on Tuesday November 29, 2022 @08:30AM
(#33787306)
I thought the C11 memory model was considered correct, possibly modulo 'consume' which seems to be ignored. The implementation in terms of types instead of operations has a performance cost but otherwise works. What glaring flaws do you have in mind?
Re:Const vs. constexpr vs. consteval vs. constinit in C++20
by cyber_kinetist on Tuesday November 29, 2022 @12:10PM
(#33790221)
Well, not exactly “glaring” (unless you are a PL expert), but for instance there’s a paper that was referenced in that Rustonomicon link:
https://fzn.fr/readings/c11comp.pdf
And also
https://plv.mpi-sws.org/scfix/paper.pdf
Though maybe these issues were fixed in C++20 (which I only learned till recently that they’ve revised their memory model there!)
Re:Const vs. constexpr vs. consteval vs. constinit in C++20
by JonChesterfield on Tuesday November 29, 2022 @07:23PM
(#33795289)
Nice references. Going to take me a while to make sense of them. A superficial interpretation is one says relaxed doesn't work and the other says sequentially consistent doesn't work. Not great news tbh, hopefully it'll look better on closer examination.
In practice, it seems like the C/C++ model has some glaring flaws anyway, so I can’t say that Rust’s is really “worse”. But since Rust has this mission to be better than C++ in terms of safety, this is one of thorny issues of Rust that need to be tackled to really let its advantages shine.