HNHacker News
TopNewBestAskShowJobs

quelsolaar

3,279 karma · joined October 26, 2013

submissionscomments
quelsolaar··on C's Flexible Integer Sizes Were Not a Design Mistake
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.

quelsolaar··on C's Flexible Integer Sizes Were Not a Design Mistake
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.
quelsolaar··on C's Flexible Integer Sizes Were Not a Design Mistake
At the time its was probably very hard to know what the fixed sizes should be.
quelsolaar··on C's Flexible Integer Sizes Were Not a Design Mistake
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>

quelsolaar··on Nitpicking the shell history scene in 'Tron: Legacy'
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
quelsolaar··on Everything in C is undefined behavior
The things you want from C isn't C. Id advice you to use another language.
quelsolaar··on Everything in C is undefined behavior
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.

quelsolaar··on Everything in C is undefined behavior
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."

quelsolaar··on Why are we still using Markdown?
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.
quelsolaar··on Oracle slashes 30k jobs
Do not make the mistake of anthropomorphising Larry Ellison.
quelsolaar··on Just 0.001% hold 3 times the wealth of poorest half of humanity, report finds
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.
quelsolaar··on Brent's Encapsulated C Programming Rules (2020)
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.
quelsolaar··on Work is not school: Surviving institutional stupidity
Yeah the idea i that school is somehow a bastion of meritocracy is misguided.

Academia is better at setting clear requirements and measuring those goals, but whether these requirements have anything to do with being successful or useful in the real world is an entirely different matter.

School isn't reality, its mostly not even trying to simulate reality. School breads a lot of "Why was I not rewarded? I did everything they said i should do" disappointment in the real world.

quelsolaar··on If all the world were a monorepo
This is awesome. I run a team that uses software I produce and i have a rule that i can’t deliver breaking changes, and i cant force migrations. I can do the migration myself, or i have to emulate the old behavior next to the new. It makes you think really hard about releasing new APIs. I wish this was standard practice.
quelsolaar··on Never write your own date parsing library
Writing in binary or cranking your own electricity is easy. Anyone can do it.

There is a difference between things that are difficult and things that just take a lot of work.

quelsolaar··on Never write your own date parsing library
Your customers will pay more for things that are hard to do. Ask ASML.
quelsolaar··on Never write your own date parsing library
I exclusively write in C89. I'm a member of the ISO C standard board.
quelsolaar··on Never write your own date parsing library
When ever i see "never implement your own...", i know i want to implement it myself. People say that about hard things, and I only want to do hard things. Nobody wants people who can do easy things, people want people who can do hard things. The only way to learn how to do hard things, is to do hard things, so do the hardest things.

So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard.

quelsolaar··on A new law in Sweden makes it illegal to buy custom adult content
Maybe the victims of gunshots wanted to be shot? People shoot themselves all the time.

Should we make convictions of murder, depndent on proving that the victim dint actually want to get shot?

quelsolaar··on A new law in Sweden makes it illegal to buy custom adult content
Yeah thats an old idea, that have proven again and again to cause misery. Its not flimsy at all. Its peer reviewed science.
quelsolaar··on A new law in Sweden makes it illegal to buy custom adult content
Yes, Sex work can be made more safe. However none of these protects against the psychological harm that may sex workers are experiencing. There is plenty of evidence how harmful prostitution can be to mental wealth.

You list things that regulated to protect the user of drugs, tobacco and alcohol, but with prostitution, the product is a human being that needs to be protected too.

The Nordic model, does not outlaw selling sex, but criminalizes buying. In my opinion, selling sex may be harmfull, but i see no ethical reason against it. However there is no ethical way to buy sex, because its impossible for a buyer to be sure that you are not causing serious harm to the person you are buying from.

quelsolaar··on A new law in Sweden makes it illegal to buy custom adult content
We want to protect vulnerable members of society. they come in all sizes and shapes.
quelsolaar··on A new law in Sweden makes it illegal to buy custom adult content
I'm saying that hiring people to do a job that is extremely dangerous, and likely to cause the worker harm, especially for your own enjoyment is exploitative.

Most of the jobs you list are FAR safer then prostitution. But yes I would argue there are lots of other jobs that i would outlaw for the same reason. Like Bumfighting, a lot of dodgy construction, self harm, jobs without proper safety equipment, gladiators, and a lot of military recruitment. You are exploiting, or are very likely to be exploiting people in dire situations.

quelsolaar··on A new law in Sweden makes it illegal to buy custom adult content
I'm ok with outlawing adults with free wills, getting payed to play russian roulett even if five out of six wont take a bullet to the head. Adults can be exploited too.

"neither harmful", tells me you know nothing about the subject.

quelsolaar··on Is it possible to write plain C iOS app in 2025?
Yes, Objective C is built on some deep C calls you can call directly. I was a part of a project that built an automatic wrapper generator for C. Check it out at https://felixk15.github.io/posts/c_ocoa/
quelsolaar··on An 'Administrative Error' Sends a Maryland Father to a Salvadoran Prison
As a foreigner to the US, this gives you real pause about working or even visiting the US, even if you have all your papers in order. I guess that's the point.
quelsolaar··on Asahi Linux lead developer Hector Martin resigns from Linux kernel
The policy of "No C++, because I don't want to deal with C++ people", should be extended to the Rust community. Whatever you think of the merits of the Rust language, the drama, the lecturing and the general superiority complex of the Rust community is quite off putting, at least to C developers.
quelsolaar··on Israel, Hamas reach ceasefire deal to end 15 months of war in Gaza
Gaza has changed.
quelsolaar··on C: Simple Defer, Ready to Use
Not right there, some other place in the function. Also people will start adding defer in macros and then things will go sideways.
quelsolaar··on C: Simple Defer, Ready to Use
...and a we would get a host of new bugs that would be a lot harder to fix. Invisible jumps are very bad.
Page 1 of 18Next →