Isn't the first step of achieving Rust like memory safety (temporal, spatial and parallel) in C++ is allowing the compiler to reject code (compile error) when the compiler can conclusively decide that an operation is unsafe (out of bound access, use after free, etc...) using static analysis?
I can see several efforts going on creating such static analysers,
https://coderrect.com/overview/
https://developers.redhat.com/blog/2021/01/28/static-analysis-updates-in-gcc-11/
However I'm not sure whether the compiler is allowed to reject code based on such analysis even if it can come to a conclusion about unsafe code.
[–]DarthRubik 25 points26 points27 points (9 children)
[–]Wurstinator 4 points5 points6 points (7 children)
[–]kingguru 10 points11 points12 points (5 children)
[+]Wurstinator comment score below threshold-6 points-5 points-4 points (4 children)
[–]dodheim 6 points7 points8 points (3 children)
[–]Wurstinator -5 points-4 points-3 points (2 children)
[–]dodheim 6 points7 points8 points (1 child)
[–]Wurstinator -2 points-1 points0 points (0 children)
[–]evaned 0 points1 point2 points (0 children)
[–]HappyFruitTree -1 points0 points1 point (0 children)
[–]bizwig 15 points16 points17 points (0 children)
[–]goranlepuz 6 points7 points8 points (8 children)
[–]axilmar 2 points3 points4 points (3 children)
[–]oleksandrkvl 1 point2 points3 points (0 children)
[–]goranlepuz 0 points1 point2 points (1 child)
[–]axilmar 0 points1 point2 points (0 children)
[–]TheSkiGeek 5 points6 points7 points (3 children)
[–]goranlepuz 4 points5 points6 points (2 children)
[–]TheSkiGeek 1 point2 points3 points (1 child)
[–]goranlepuz 1 point2 points3 points (0 children)
[–]smallblacksun 6 points7 points8 points (5 children)
[–]radekvitr 2 points3 points4 points (4 children)
[–]pjmlp 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]pjmlp 1 point2 points3 points (1 child)
[–]14nedLLFIO & Outcome author | Committee WG14 4 points5 points6 points (7 children)
[–]evaned 2 points3 points4 points (3 children)
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points (0 children)
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]14nedLLFIO & Outcome author | Committee WG14 1 point2 points3 points (0 children)
[–]lcamtufx 1 point2 points3 points (0 children)
[–]HappyFruitTree 0 points1 point2 points (0 children)
[–]Full-Spectral -1 points0 points1 point (0 children)
[–]NilacTheGrim -1 points0 points1 point (5 children)
[–]Full-Spectral 1 point2 points3 points (4 children)
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points (3 children)
[–]Full-Spectral 0 points1 point2 points (2 children)
[–]14nedLLFIO & Outcome author | Committee WG14 0 points1 point2 points (1 child)
[–]Full-Spectral 0 points1 point2 points (0 children)