quelsolaar

Joined 13 years ago

Karma
3,280
Submissions
565
Member since
Oct 26
View on Hacker News

Recent submissions

Comment · 4 days ago
If you are trying to buy some place to live, it doesn't just matter how much money you have, it also matters if there are lots of people many times wealthier than you bidding for the same realestate.

More money doesn't create more things to buy or more people making things, its just means more money competing for the same things to buy. Other people having more does diminish your share, of the cake. Yes, we can make the cake larger, but the best way to do that is for more people to get more opportunity to fulfil their potential, by getting a reasonable share to do so.

Comment · 1 month ago
One a modern computer, the ideal integer type is usually smaller than 64 bits. Even though the arithmetic units handle 64 bits in one op, 64 bits take up twice the memory bandwidth, and half as many fits in a cache-line, and given that a modern computer is usually bound by memory access, smaller is better. So you can argue that both new and old computers prefer 32 bit over 64, but for different reasons.

The added compatibility between 32 and 64 bit systems, is another reason. Also if you choose int to be 64 bits, what would you make short? 16 or 32 bits? It makes much more sense to keep int 32 bits, and reserve long / long long for 64 bits.

Comment · 1 month ago
That's not true. All the basic types have minimum sizes, so its perfectly reasonable to write software that stays within those bounds. You can avoid any overflows if you know the minimum limits.
Comment · 1 month ago
At the time its was probably very hard to know what the fixed sizes should be.
Comment · 1 month ago
Good article.

C would probably not have survived unless it had this flexibility.

But its not justa historical thing. Today there are modern platforms like DSPs that have 32bit sized char, because that is the smallest addressable type. These platforms depend on C for tool chains, even if most "portable" C wont run correctly on them. The fact that you can build hardware like that, and not have to invent a new language / dialect to program them is a huge win for the world.

<edit> I didnt see the footnote about DSPs at first read </edit>

Comment · 5 months ago
I was luck to know Josh Nimoy who is responsible for a lot of this in the movie, who has since sadly passed away. Josh took great pride in the fact that he was able to put Emacs and a bunch of Unix commands in a major Hollywood blockbuster.ed
Comment · 5 months ago
The things you want from C isn't C. Id advice you to use another language.
Comment · 5 months ago
A lot of the Central UB can not be defined, because they rely on detection. In order to have a well defined behaviour (by the standard or the compiler) the implementation needs to first detect that the behaviour is triggered, this is often very tricky or expensive. Its easy to define that a program should halt, if it writes outside an array, but detecting if it does can be both slow and hard to implement. There are implementations that do, but they are rarely used outside of debugging.

A better way to think about UB is as a contract between developer and implementation, so that the implementations can more easily reason about the code. How would you optimize:

(x * 2) / 2

An optimizer can optimize this out for a signed integer, because it doesn't have to consider overflow, but with a unsigned integer it can not. UB is a big reason why C is the most power efficient high level language.

Comment · 5 months ago
The 5 stages of learning about UB in C:

-Denial: "I know what signed overflow does on my machine."

-Anger: "This compiler is trash! why doesn't it just do what I say!?"

-Bargaining: "I'm submitting this proposal to wg14 to fix C..."

-Depression: "Can you rely on C code for anything?"

-Acceptance: "Just dont write UB."

Comment · 7 months ago
Mark down is great because it doesn't define a bunch of things. Headline? Its a headline, no font, no sizing, no colors... Just a headline. It means that it can be displayed on any device, printed on any paper, work with any accessibility tool and optimized for what ever requirements the reader has, not what ever the writer thought looked good. The web is full of great content being made hard to access because of poor/inflexible layout choices. Just give me the text and let me choose how to make it readable. The added fact that you can read raw markdown without even parsing it makes it even better. Not having total control over what its going to look like for the reader is a feature not a bug.
Comment · 7 months ago
Do not make the mistake of anthropomorphising Larry Ellison.
Comment · 10 months ago
This, "If you have enough, why does it matter if someone else has more" argument doesn't really hold. Yes we can make more TVs and phones so that everyone can get one, but then get to things like centrally located housing, where there is a limited supply. It matters a lot if you want someplace to live, and there are thousands of very rich people trying to out bid one and other for the same space in your city. This is why housing is no longer affordable.
Comment · 10 months ago
Thanks for the shout out. I had no idea my 2h video, without a camera 8 years ago would have such legs! I should make a new one and include why zero initialization is bad.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton