HNHacker News
TopNewBestAskShowJobs

teo_zero

1,521 karma · joined August 14, 2022

submissionscomments
teo_zero··on The Best Monopoly Strategy, Tested on 300M Games [video]
You seem to reason in terms of trying at all costs to block the other players, not to maximize your gain. I agree the ultimate goal is to do better than all the others, but the tactics to get there may involve temporarily favoring other players in win-win exchanges to grow quicker, or to block a third player already far ahead, etc.
teo_zero··on C vs. C#: racing VLC's Gaussian blur
Nice article!

What surprises me is that the original VLC filter does not use SIMD. Sometimes I wonder why I spent my money on a "modern" CPU with a lot of new features that stay completely ignored by most software I run every day.

teo_zero··on Putting Linux on my RTX Spark laptop because I don't have a Microsoft account
> you don't even mention the existence of Apple silicon at all?

Given the reasons she lists for not wanting Windows, I can't imagine her entering Apple's closed garden.

teo_zero··on Putting Linux on my RTX Spark laptop because I don't have a Microsoft account
To be fair, TFA lists more reasons to avoid Windows:

> Mine include the privacy concessions during setup, the years spent waiting for Microsoft to let people put the taskbar on the side of the screen again, and the advertising.

Of course you don't have to agree on all of them, but please don't assume everyone acts only because they can't find a tutorial on the net!

teo_zero··on Europe EV sales rose 70.3% in September, 32.6% of market share
> Cheaper, faster, smoother, quieter, wake up every day to a full "tank", less things to go wrong

I agree to everything except waking up every day to a full "tank". That's only if you have your own house. If not, you'll depend on public chargers, so you'll buy "fuel" at premium prices, possibly higher than petrol, and you'll have to move your car at the end of the recharge in the middle of the night to avoid the parking fee.

teo_zero··on Fun Extending the C Preprocessor
Doing non-trivial anything you slow down compilation, make debugging harder and increase fragility and complexity. Sometimes that's a mistake, sometimes not.

Getting rid of something because someone sometimes abuses it, is short-sighted.

teo_zero··on Making chicken transparent using Dorito dust
I'm sure this research has some higher motivations behind, but I can't help foreseeing an ignobel coming soon!
teo_zero··on Fun Extending the C Preprocessor
There are a couple of constructs that you end up re-creating as soon as you need non-trivial preprocessing.

One of those is the two-stage CAT, another one is the NARG the article talks about.

__COUNTER__ is going to be added to C29, the next version of the standard, maybe there's hope for __VA_COUNT__ and __CAT__ too!

teo_zero··on Arena Allocators in C
> unless you assume something not-strictly-portable about `(uintptr_t)p`

What's not strictly portable about it?

  padding = -(uintptr_t)p & (align - 1)
The only assumption here is that align is a power of 2, which is guaranteed if it's the result of an alignof().
teo_zero··on Arena Allocators in C
Please be aware that pointer arithmetic is not defined on void * pointers, although many compilers allow it. You had better use char * for "data".

Also, your code is prone to overflow when you add data, used, alignment and size.

And finally, the realloc function could be reworked to do nothing if new_size is <= old_size.

teo_zero··on Vectorized CLZ and CTZ
To be fair, the article contains 3 methods. The first one is original, the second one is the same algorithm you linked, and the third one is an evolution of it.
teo_zero··on C for Rust programmers
> zero-initialization via `= {0};` will still leave padding and any data not covered by the smallest elements of unions uninitialized

You really should move to C23 and use ={}.

teo_zero··on C for Rust programmers
If C was not supposed to be changed to correct its past mistakes, we would still increment with a=+1 instead of a+=1, or we would use something called nunununuC.

> C11 is last C as far as I'm concerned.

Are you sure? I think C23 brought so many enhancements it's a pity to ignore it.

teo_zero··on C for Rust programmers
If the author is taken aback by '->' vs. '.' and by true and false being 1 and 0, I'm surprised they haven't mentioned digraphs and trigraphs, or the alien <name> syntax for #include!
teo_zero··on System-level ad-blocking in Android
Why do you need an app at all? Can't you just manually set a private VPN in the settings?
teo_zero··on Vx – One Language, Every Chip
But Vx needs a "machine file" for each target hardware, and none is provided for Intel:

> The repository ships machine files for H100, H200, B200, A100, MI300X, Apple M4 and multi-GPU nodes

So it seems it won't work out of the box.

teo_zero··on Vx – One Language, Every Chip
> One Language, Every Chip [...] CPU, GPU, NPU [...]

Every chip? For example if I target an Intel Meteor Lake (I'm not picking a niche one), does it compile for this CPU, its integrated NPU and its Arc GPU?

teo_zero··on Nissan's third generation e-POWER powertrain
> Why bother going to all this effort for an internal combustion engine (crossbow)?

Because it sells well? Because it's what a significant portion of people want?

> Its pretty obvious where the future is headed for personal vehicles

"Where", yes. "When" is a big question mark. If the transition will take several years to complete, which many bet it will, it makes perfectly sense to offer a car that people is willing to buy in the meanwhile.

The Chinese brands that you mention also offer hybrids: indeed most BYDs I see in the streets have the "DMi" tag, which is BYD's codename for hybrid. And they are investing in fuel engines, too. Only short-sighted euro burocrats think that since EV are the future we should immediately stop selling and innovating fuel cars.

teo_zero··on Nissan's third generation e-POWER powertrain
> it isn't recognised at all as hybrid vehicle in Germany

You surely mean that it is not recognized as plug-in hybrid vehicle.

teo_zero··on Nissan's third generation e-POWER powertrain
Could you please elaborate what is crossbow and what is machine guns in your metaphor?
teo_zero··on Excel now supports multiple values in a single cell
I imagine adding this feature has cost many hours of development. Aren't there lower-hanging fruits to please Excel's users? What about allowing user-defined shortcuts? E.g. to edit a cell it's still either the mouse or F2, neither of which is comfortable on modern laptops.
teo_zero··on C++26: Trivial infinite loops are no longer undefined behaviour
> Why use a for loop with a bound as an example instead of while loops with linked lists?

I'm the author of the example. I wanted to keep it as simple as possible, and this is the most common form of for loop. I was sure that HN readers would be clever enough to "map" it to whatever they have in their mind that satisfy the undecidability of the condition.

But since you're nitpicking, I haven't specified the types of i and n: i is uint8_t and n is uint32_t. Does it terminate? It depends on the value of n!

teo_zero··on C++26: Trivial infinite loops are no longer undefined behaviour
Whenever you write a succinct example or a metaphor to try to explain in a few words a complicated concept, someone will nitpick small details of your construction, thus focusing on the form and missing the spirit!

Forget if "i<n" is decidable or not: the sense is that there will always be some loops that the compiler can't determine if it's finite or not.

Forget if A and B can alias or not: the sense is having two independent actions that can be executed in the same loop or in two consecutive loops.

Let's see... what about the following example, that replaces all a's with @ and all e's with & in a zero-terminated string s?

  for (char *p=s; *p; p++)
    if (*p=='a')
      *p='@';
  for (char *p=s; *p; p++)
    if (*p=='e')
      *p='&';
If a compiler is allowed to assume that the first loop terminates, then it may optimize it to:

  for (char *p=s; *p; p++) {
    if (*p=='a')
      *p='@';
    if (*p=='e')
      *p='&';
  }
Is this explanation less insane?
teo_zero··on C++26: Trivial infinite loops are no longer undefined behaviour
> I'm not sure what this has to do with my comment

Because you explicitly mentioned details that belong in the implementation, not in the semantic:

> A halt/abort instruction that trashes [the] state would be undesirable

If you want to attach a debugger, then use a breakpoint, don't try to obtain the same effect within the code.

teo_zero··on C++26: Trivial infinite loops are no longer undefined behaviour
Take this example:

  for (i=0;i<n;i++)
    A[i]=0;
  for (i=0;i<n;i++)
    B[i]=0;
It can be conveniently transformed into this:

  for (i=0;i<n;i++)
    A[i]=B[i]=0;
They are exactly equivalent except if the first loop never terminates.

Now, the compiler could try to understand if the first loop does or doesn't terminate, and apply or not the optimization accordingly, but Turing tought us that is indeed a hard task!

Or it could decide to never apply it, for fear of those rare and usually pathological cases where the first loop doesn't terminate.

Or it could decide to apply it by default and accept that in those cases the program does something different than what the source code says. The latter is better known as UB.

The third option won, and that's why infinite loops are UB in the standard.

teo_zero··on C++26: Trivial infinite loops are no longer undefined behaviour
Expecting a piece of code to be compiled to a precise sequence of machine instructions is exactly what you should not do with high-level languages like C++. Their task is exactly to abstract the machine away. They give you the guarantee that the final observable result will be what you asked for, not that the means to obtain that result will be what you have in mind.

If you write a loop to zero out some memory, it can be compiled to a loop, or to a call to an optimized predefined function, or even to a sequence of single zeroing instructions, if the size is small enough.

Even a single statement as a=0 may be compiled to a "load immediate" instruction, or an "XOR with itself", or a "sub with itself", or a move from another register known to be 0.

teo_zero··on Base84 deserves a place in file names
> How about case-insensitive filesystems? [...] Negligible.

I don't buy this. Finding collisions is pretty easy. In one repository I have these files:

  rank2.cpp
  rank4.cpp
  rankN.cpp
The last two have the same case-insensitive Base84 encoding:

  mz{QkARW;1cB
  mz{QkaRW;1cB
teo_zero··on Customizing my Compaq MX-11800 keyboard
> I really like this website design

Reading it on my phone, I beg to differ.

teo_zero··on Show HN: GET Together – A social network where you don't need POST to Post
Doesn't pressing "back" in the browser repost the same message?
teo_zero··on New type of dice guarantees no tie when deciding who goes first
How do you decide who is going to pull the tokens?
Page 1 of 31Next →