An insertion op inserts one element into a sorted list. A bubble op bubbles the maximum (or minimum) element to the end of an unsorted list.
2,239 karma · joined April 3, 2024
An insertion op inserts one element into a sorted list. A bubble op bubbles the maximum (or minimum) element to the end of an unsorted list.
You're absolutely right, and we know so, because that middle ground actually existested before Roe v. Wade was overturned. Abortion was available but regulated.
What the article quotes Linus complaining about is a process issue. Paragon apparently used GitHub's GUI to merge some of their branches rather than the git CLI. Linus would prefer they use the CLI to merge branches because the GitHub GUI reportedly omits important metadata from merge commits, such as the developer email, and encourages uninformative commit messages.
> They’ll simply describe an interactive protocol with the right structure, then they say something like “of course this can be flattened using Fiat-Shamir, if we assume a random oracle or something” and everyone nods and deposits a billion dollars onto it.
- Linear congruential generator[2]:
xₜ = a xₜ₋₁ + c mod m
- Mersenne Twister[3]: too complicated for a few lines
- Subtract with carry[3]: k < p
carryₜ = [xₜ₋ₖ - xₜ₋ₚ - carryₜ₋₁ < 0]
xₜ = xₜ₋ₖ - xₜ₋ₚ - carryₜ₋₁ mod 2ⁿ
All three algorithms are fairly popular.(Please excuse the unidiomatic index and constant names, I'm at the mercy of unicode)
[1]: https://en.cppreference.com/w/cpp/header/random
[2]: https://en.wikipedia.org/wiki/Linear_congruential_generator
def advance_state(state):
state ^= state << 1
state ^= state >> 3
state ^= state << 10
return stateRust calls references to uninitialized memory undefined behavior because it wants to reserve the right to implement some kinds of optimizations using that fact in the future, however currently no optimizations do, and in fact the standard library depends on the compiler being well behaved here.
It's possible at some point in the future some optimization will be added which would cause problems for references to uninitialized memory, but it seems more likely that the requirements on references will eventually be relaxed instead.
[1]: https://github.com/rust-lang/rust/issues/119241#issuecomment...
2.The specific scenario I had in mind was: write value X to address A from core 1, write value Y to A from core 2, read value from address A from core 1 (still X in core 1's cache), core 1 cache gets invalidated, read value from address A from core 1 again (now it fetches Y from memory).
See [1] for reference on how it applies to C specifically, especially "Absent any constraints on a multi-core system, … one thread can observe the values change in an order different from the order another thread wrote them".
[1]: https://doc.rust-lang.org/std/ptr/#pointer-to-reference-conv...
Not even there, due to memory caches.
However, in C, the programmer doesn't need to prove to the compiler that uninitialized memory is never read, they are just expected to prevent it from happening. In this case, it's clear to the programer that there's no undefined behavior.
In Rust though, the compiler must be able to statically verify no undefined behavior can occur (except due to unsafe sections). It's not possible to statically verify this in either the Rust or C case, because not enough information is encoded into the type signature of `read`. The article discusses a couple of ways that information might be encoded so that Rust can be more like C, and discusses their trade-offs. C explicitly sidesteps this by placing the responsibility entirely on the programmer.
So to directly answer your question "Why can't Rust act like C when faced with empty buffers?", it's because the Rust compiler cannot yet statically verify there's no undefined behavior in this case, even though there is in fact no undefined behavior, and one of the primary design goals of Rust is to statically prevent undefined behavior.
And to what's perhaps the initial question, this is discussed using the term "safety" simply because Rust defines things which can't be statically verified to not invoke undefined behavior as "unsafe". Perhaps a better term would be "not yet statically provable as safe", but it's a bit of a mouthful.
> C code that reads uninitialized data is presumed to be buggy, because it wouldn't be doing that unless it thought the memory was initialized. But the read itself is not unsafe.
The read itself is very much unsafe because it's undefined behavior. The compiler is allowed to assume the programmer doesn't allow reads to uninitialized memory to happen, so if the programmer does allow a read from uninitialized memory, any false conclusion can follow from the false assumption.
This is a problem even in trivial cases; see [1] and try commenting out and switching arround the calls to foo and bar. The behavior is very unintuitive, because reads from uninitialized memory is unsafe.
Wait no longer: https://www.youtube.com/watch?v=mcI1kUvVMYM
Maybe I'm living under a rock; what extreme views are going through the school system?
All evidence so far indicates they will not make it right, but instead they may make it even worse. Your faith is wildly misplaced. Seriously, talk to a lawyer.
Keep in mind, just because you seek advice from a lawyer doesn't mean you need to take legal action against the school. Talking to a lawyer is not an escalation; the school doesn't even need to know you consulted one. A lawyer will advise whether you should take legal action and any more amicable alternatives available before they do anything on your behalf.