Hacker Newsnew | past | comments | ask | show | jobs | submit | orlp's commentslogin

I think if you interpret it charitably it means that any bug in the emitted machine code is already a likely memory-unsafe miscompilation if it is ran.

The compiler itself might be perfectly "memory safe" but the generated binary fundamentally is always at risk (besides WebAssembly I suppose).

I'm fully aware of the separation of compiler and binary, and being able to compile untrusted code safely is nice, but a perfectly safe compiler that generates vulnerable binaries isn't that much better.


I do think that is a good point, it's just not what the line actually says. But that's why I wasn't saying "zomg this is WRONG!!!!" but instead, trying to point out that there are subtleties here. For people who aren't as deep in the weeds in this subject, I think the details matter. But again, as I said, I like the post, this is just one thing.

I am also probably in a more pedantic mindset because, well, I'm writing a compiler in Rust, and the words as written do not resonate with me at all.

> a perfectly safe compiler that generates vulnerable binaries isn't that much better.

I do think it's much better. Eliminating classes of bugs in one component is a good thing, even if it's not every component. This is a core lesson of Rust! unsafe still exists, but going from "I don't know what is unsafe" to "only this part is unsafe" is a major improvement.


In context that's clearly not what he's saying, the next sentence is this:

> Zig has more features than Rust for making memory-unsafe code work correctly, and that was the area where we wanted the most help.

Zig definitely does not have more features for successfully emitting memory-unsafe machine code than Rust does. I can emit memory-unsafe machine code from typescript if I really want to and nothing at all in the language will get in my way. So the sentence quoted above must refer to the idea that the compiler itself needs to be unsafe, which Steve is right is simply untrue.


The section this came from was talking specifically about usages of `unsafe` in the compiler code.

It's not about the memory safety of the resulting binary.


That's a GCC skill issue. You can do it in five branchless instructions for unsigned by splitting the unsigned up in two 32-bit halves, converting those to floats simply by inserting their values as mantissa into constants 2^52 and 2^(52 + 32). This conversion is exact.

Then to finish the conversion you subtract 2^52 and 2^(52 + 32) respectively from the halves and add them together.

    vmovq       xmm0, rdi
    vpunpckldq  xmm0, xmm0, xmmword ptr [rip + .CONST1]
    vsubpd      xmm0, xmm0, xmmword ptr [rip + .CONST2]
    vshufpd     xmm1, xmm0, xmm0, 1
    vaddsd      xmm0, xmm1, xmm0
Here CONST1 = [0x43300000, 0x45300000, 0, 0] and CONST2 = [0, 0x43300000, 0, 0x45300000].


Don't give these ghouls ideas.


The idea of putting a PepsiCo or Coca-Cola ad on the moon dates backs to the 60's, when we first went there.


First, this article is mostly (AI?) regurgitation. This is much better: https://smalldatum.blogspot.com/2026/01/common-prefix-skippi....

Second, I have independently invented this (quicksort on string prefixes) at my time at CWI, although I didn't end up publishing it, because...

Third, this was already published in the original 1961 Quicksort paper by Hoare: https://www.cs.ox.ac.uk/files/6226/H2006%20-%20Historic%20Qu.... Near the end, the section on "Multi-word keys" describes a quicksort that partitions on just the first word, and only accesses the next word for the equality partition. And funnily enough this paper credits P. Shackleton for this, thus this idea was thought of even before the Quicksort paper came out.

So as is usual for software patents, this patent never should have been awarded.


This is a dumb take. It's like not teaching kids 1 + 1 because a calculator can do it for them.


If your data is sufficiently noisy or your relationship sufficiently simple a linear regression will outperform a SOTA LLM.


You save a lot less after paying import duties.


Do you pay import duties in the UK on items purchased for personal use? The situation is changing constantly in the US, but generally speaking you do pay duties only over a certain dollar amount in value if you intend to keep the item in country after importation (and a MBP would be over that amount), but it's a fairly small percentage (around $400 in duties on $3149 saved here). I'm not sure how it'd work in the UK.


It seems like there aren't extra duties (anymore), but then again it's all very confusing and hard to navigate so who knows.


Actually, they're making an effort to force your business to not do something.


> Is there really anything about them that's bad? Or any worse than other things?

A full-on nuclear war will literally make a large portion of our planet uninhabitable for anyone for centuries, and leave the rest severely crippled and contaminated.

Sorry I know we're supposed to be kind and whatnot in these comments but I can't help but explicitly state that your comment is one of the dumbest things I've read on this site in a while. I hope you otherwise have a good day.


Please re read the start of my comment.

I took a contrary position in a debate just to spark a deeper discussion. Which it has. I didn’t say I believed this.


https://en.wikipedia.org/wiki/Conscription_in_Iran

FWIW I don't agree with the comment chain's source, I read "regular people" as "civilians" and don't think there was any nasty connotation meant.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: