Recent submissions

Comment · 1 day ago
No they aren't.
Comment · 1 day ago
This fails on overflow: if N == INT_MAX then your loop doesn't terminate and actually invokes undefined behavior in C.

The safe way to write it is:

    for (int i = 0; i < N; ++i) {
        something(array[N - 1 - i]);
    }
(or with size_t instead of int depending on the type of N)
Comment · 1 day ago
> For the uninformed: counting backwards in a for loop is faster because comparing an unsigned integer against 0 is generally faster than comparing it against any other value.

No it's not. It generally makes no difference at all.

If you disagree, I dare you to write a benchmark that demonstrates a difference between forward and backward iteration on a modern CPU.

Comment · 9 days ago
It's not interesting at all given that these models have been fine-tuned to hell and back to make sure they never say anything offensive at all. Remember these model were taught that it's better to kill a billion people in a nuclear holocaust than to say the n-word even once. They didn't come up with this from first principles; it was the RLHF training that forced them to say that, ridiculous as it obviously is.

And after people pointed this out the training was updated to address just this particular scenario, but they kept all the other guard rails to ensure an LLM could never offer any truly controversial opinion.

So expecting a controversial answer from an LLM is exactly as foolish as expecting a candidate at a job interview to give an honest answer to the question "What is your greatest weakness"? Every candidate will insist they are just too much of perfectionist; nobody is ever a lazy alcoholic brownnoser. But how many of your colleagues fall in the former category vs the latter?

> If the latter, then it casts new light on the debates over whether LLMs can replace all white collar work. Because some of the most valuable human work is breaking false consensus.

On the contrary; the ability to whip LLMs into submission like this makes them the ideal white color workers. Do you think Steve Jobs wants a level 2 engineer to talk back to him?

Of course being obsequieous asskissers isn't the only mode for LLMs. I'm sure all the big labs have unfiltered versions of their models that give actual true answers; they just know better than making them publicly available. Can you imagine if you asked an LLM how to prevent climate change and it honestly answered "decimate the human race" rather than "drink soda through soggy paper straws"? All the fragile humans would be up in arms.

No, the LLM must lie and pretend they don't have controversial opinions at all.

Comment · 9 days ago
I'm a little mad because it's the principle of the thing.

In practice the only site I occasionally want to check that's blocked is Polymarket. I don't trade on there myself, but I find it useful to check the odds of certain events.

Comment · 9 days ago
I suppose that's it.

It still feels a little strange that that loophole is allowed: everyone who has a Swiss ISP could switch to Quad9 and be strictly better off. But if everyone does that, then the DNS ban is completely ineffectual. Maybe I should let sleeping dogs lie.

Comment · 9 days ago
Comment · 9 days ago
That doesn't define little-o at all?

In fact, he refers to Landau for the definition of little-o.

Comment · 9 days ago
Comment · 18 days ago
Isn't the obvious choice std::variant<>?

It is kind of annoying to use, but at least there is an obvious default choice.

Comment · 23 days ago
> What happens if hiring picks up again? Do you just re-instate the H1b program?

Yes, why not? Or more practically: keep the program but adjust the quotas annually or even quarterly based on needs. When you see tech companies laying off workers by the thousands, as happened over the past few years, that's the sign that there is plenty of local talent to be hired.

> Will people really come to the US on a H1B if they know they can get scaled down like a cloud server at the first sign of economic trouble or the first sign that some politician wants some brownie points?

The solution to that is to separate visa renewals from new hires: allow companies to keep existing workers, while forcing them to hire new ones locally. This actually makes America _more_ attractive for immigrants because they know they cannot be replaced with a new generation of cheap workers from their home country when economic conditions worsen.

> But even the narrative that hey microsoft fired 1k citizens and hired 1k H1bs that are lower paying is false.

In what sense is it false? Microsoft claims that of its 6,800 H1b filings 80% were “related to employees already working at Microsoft” (note no mention _which country_ those employees were working in) which translates to 20% to or 1720 new employees they hired.

And for pay, they only state that “international workers that Microsoft does hire through the H1b visa program are paid the same level of compensation that a worker from the US would receive”, but of course the point is that the average level of compensation for new hires today is significantly lower than it was 10 years ago, when there was a tech worker shortage.

So it can be simultaneously true that the current-year H1b hires are hired at the same rate Americans are, but that those rates are substantially lower than the negotiated compensation of the people Microsoft laid off. The fact that Microsoft declines to comment on this,

So the following are almost certainly all true:

  - Microsoft fired (or laid off) over 1000 American citizens last year
  - Microsoft applied for H1b visa for at least 1000 _new_ employees
  - Those new employees will almost certainly receive lower compensation than the citizens that were laid off
Please, if you think this narrative is false, which of these facts are you specifically disputing?
Comment · 28 days ago
C++ lambdas are just structs that overload operator(); once you realize that they become a lot less mysterious. But it's a great example of how this tool is useful to learn about those things (of course you could also read the C++ standard but who has time for that?)

Here's an example: https://cppinsights.io/s/f04b6896

(That also shows how C++'s range-based for-loops work, which is similarly some syntactic suger for a fairly mundane for-loop, but details are interesting: unlike a typical for-loop, the loop variable is declared inside the loop body.)

Comment · 28 days ago
Less AI slop please.
Comment · 1 month ago
The difference with IPv6 adoption is that the internet relies heavily on network effects: so long as some hosts only have an IPv4 address, you need an IPv4 address for full connectivity, but then if everyone has an IPv4 address anyway, there is no immediate need to migrate to IPv6.

(Yes us Hacker News users have plenty of use cases for IPv6, like self-hosting and peer-to-peer networking and so on; we are not the average user.)

This effect doesn't exist for the Git migration. Each repo can be updated independently; it doesn't affect users of other repositories, and most likely, the majority of devs will work on some SHA-1 repos and some SHA-256 repos with no issue.

If anything, I would compare it with the Python 2 to Python 3 migration, which was also painful, but succeeded eventually (despite being much less necessary in the first place).

Comment · 1 month ago
It's extremely common in graph theory to use n and m to mean vertex and edge count respectively. And if you're unfamiliar with graph theory, the notation |V| or |E| is hardly more intuitive, especially if you're not an English speaker.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton