Skip to main content
30 events
when toggle format what by license comment
Dec 29, 2024 at 15:27 answer added gnasher729 timeline score: 2
S Aug 22, 2023 at 7:30 history edited Sebastian Redl CC BY-SA 4.0
added 1 character in body
Aug 12, 2023 at 19:01 comment added supercat ...that principle is to make it imossible to generate the most efficient machine code that can be guaranteed to satisfy application requirements.
Aug 12, 2023 at 18:58 comment added supercat ...produce efficient code without violating the principle "if the environment would always process a read of a certain address without side effects, an action that performs a read from that address will never have side effects beyond yielding a possibly meaningless value". Any compiler that doesn't go out of its way to disregard that principle would naturally uphold it, and violations of that principle will seldom yield performance wins outside cases where nothing an implementation might do when given invalid data would be deemed unacceptable. In other cases, the effect of violating...
Aug 12, 2023 at 18:52 comment added supercat @LeopardShark: The Standard allows compilers which are intended for tasks involving exclusively trustworthy inputs to behave in completely arbitrary fashion if a two-dimensional array is accessed with an inner subscript and compilers like clang and gcc are designed to identify inputs which would cause such accesses, conditions that could only be false if such inputs were received, and bypass such conditional checks. When using compilers that perform such transforms, it's impossible to predict anything about program behavior, but people wanting to sell compilers design them to...
Aug 12, 2023 at 17:26 comment added RonJohn @Alexander there are enough ESL people asking questions on SE that I usually overlook such slight inconsistencies. (Not in answers, though; that would get a comment asking for clarification.)
Aug 12, 2023 at 10:49 comment added LeopardShark @supercat This is absolutely true, but the list of such implementations seems to exclude Clang (although it does give a warning).
Aug 12, 2023 at 5:28 comment added Alexander @RonJohn I know about those, but that isn't what OP was referring to (or he misspoke). I was responding to the quote: "I mean, a safer language means that more code is written inside the compiler, right?" He didn't say "more code is written by the compiler." I thought he was referring to the compile-time cost of more complex type systems, language rules and static analysis. He may have just misspoke, and indeed, some safety features require runtime checks to enforce, but not all (something something "zero cost abstraction", "Rust", etc. ;) ).
Aug 12, 2023 at 1:28 comment added RonJohn @Alexander something has to check array accesses for boundary errors, and that something is extra code which gets executed every time you try to access an array element. That's just one example of run-time safety checks.
Aug 11, 2023 at 22:28 comment added supercat @LeopardShark: Luck would have nothing to do with it if if one uses an implementation which, as anticipated by the authors of the Standard, extends the semantics of the language by specifying how it will process cases for which the Standard imposes no requirements.
Aug 11, 2023 at 19:00 comment added LeopardShark ‘You only get garbage values back’ if you're lucky! Your entire program becomes garbage. Such are the perils of undefined behaviour.
Aug 11, 2023 at 16:27 review Suggested edits
S Aug 22, 2023 at 7:30
Aug 11, 2023 at 7:48 answer added Matthieu M. timeline score: 73
Aug 11, 2023 at 7:14 answer added jpa timeline score: 13
Aug 10, 2023 at 21:20 answer added supercat timeline score: 1
Aug 10, 2023 at 20:38 history became hot network question
Aug 10, 2023 at 15:40 answer added Philip Kendall timeline score: 27
Aug 10, 2023 at 15:04 comment added Jörg W Mittag … could generate code which uses shared memory. Since this code was generated by the OS, the OS could guarantee that all memory accesses were safe, thus allowing for message-passing semantics and safety with shared-memory performance.
Aug 10, 2023 at 15:03 comment added Jörg W Mittag @candied_orange: A good example of this was Microsoft Research's Singularity OS where both the OS and the applications were written in Sing#, a type-safe, memory-safe, pointer-safe language. As a result, Singularity could remove a lot of the runtime checks typically used in other OSs: all code ran in Ring 0 of the CPU, all code ran in a single address space, etc. MS called these processes "SIPs" for "Software-Isolated Processes". SIPs could only communicate via message passing, but the protocol definition was provided in machine-readable format as part of the installation package, so the OS …
Aug 10, 2023 at 15:01 comment added Alexander @DocBrown Agree, but his quote says "more code is written inside the compiler", which I understood to mean he's only thinking about static time checks, not code written by the compiler, to perform runtime checks
Aug 10, 2023 at 14:41 comment added candied_orange Safety obtained at compile time is free at run time.
Aug 10, 2023 at 14:35 comment added JimmyJames This may help: nnethercote.github.io/perf-book/bounds-checks.html
Aug 10, 2023 at 13:53 answer added Christophe timeline score: 54
Aug 10, 2023 at 13:51 comment added JimmyJames I suggest that you focus the question about how Rust can implement bounds checks while having (reportedly) near-C performance on standard benchmarks.
Aug 10, 2023 at 13:44 comment added Doc Brown @Alexander: to be fair, safety is usually achieved by compile time and run time measures.
Aug 10, 2023 at 13:23 comment added Alexander "I mean, a safer language means that more code is written inside the compiler, right?" What do you mean by this? A safer language might need a more complex compiler to type-check it and enforce its safety, but that would make the compilation time slower, not the run time. And for what it's worth, C++ isn't exactly knowing for having dashing compile times, either.
Aug 10, 2023 at 13:11 comment added Euphoric Your assumptions that more security means more code and that more code means slower execution are both wrong. And your assertion about boundary checks in Rust not compiling the program are also wrong.
Aug 10, 2023 at 13:06 review Close votes
Aug 15, 2023 at 3:09
S Aug 10, 2023 at 12:38 review First questions
Aug 10, 2023 at 14:16
S Aug 10, 2023 at 12:38 history asked euraad CC BY-SA 4.0