Better HN
topnewbestaskshowjobs
Log inSign up

teo_zero

1,545 karma · joined Aug 14, 2022 (4y ago) · 937 submissions

Submissions

comment 1mo ago · link · parent

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.

comment 1mo ago · link · parent

> 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 ={}.

comment 1mo ago · link · parent

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.

comment 1mo ago · link · parent

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!

comment 2mo ago · link · parent

Why do you need an app at all? Can't you just manually set a private VPN in the settings?

comment 2mo ago · link · parent

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.

comment 2mo ago · link · parent

> 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?

comment 2mo ago · link · parent

> 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.

comment 2mo ago · link · parent

> it isn't recognised at all as hybrid vehicle in Germany

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

comment 2mo ago · link · parent

Could you please elaborate what is crossbow and what is machine guns in your metaphor?

comment 2mo ago · link · parent

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.

comment 2mo ago · link · parent

> 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!

comment 2mo ago · link · parent

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?

comment 2mo ago · link · parent

> 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.

comment 2mo ago · link · parent

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.

comment 2mo ago · link · parent

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.

comment 2mo ago · link · parent

> 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

comment 2mo ago · link · parent

> I really like this website design

Reading it on my phone, I beg to differ.

comment 3mo ago · link · parent

Doesn't pressing "back" in the browser repost the same message?

comment 3mo ago · link · parent

How do you decide who is going to pull the tokens?

comment 3mo ago · link · parent

And how do you decide who is going to throw that one die?

comment 3mo ago · link · parent

> this is just structs.

Yes. And structs are just bytes. Levels of abstractions don't do anything the underlying levels don't already do, they just give you means to express your intent in a clearer form.

comment 3mo ago · link · parent

But there are "cubic bazillions" of possible URLs that are being requested. Even if they boil down to "only" some millions actual commits, their rendered HTMLs are all different.

comment 3mo ago · link · parent

Tangent question: what about NPU performance? I always read about CPU vs GPU, but nobody talks about NPUs; I don't even know if llama supports them.

Why do phones and laptops get equipped with NPUs if there's no use for them?

comment 3mo ago · link · parent

This is for iPhones only. Do I assume correctly that the issue is solved for Android, instead?

comment 3mo ago · link · parent

> count undo as a partial game over

Not at all. Contrary to other games where undos are cheating, here they are part of the game. Without them it would be 80% luck and only 20% strategy.

> which is heavily implied

I can't find anything that implies this. It explicitly says:

> This uses undos deliberately rather than only as an emergency

while avoiding undos is mentioned at the end as "The Purist approach", which I read as slightly mocking.

I see it like a chess problem where you have to find the best sequence of moves, so you start off with an intial move, then backtrack, explore another idea, etc. Not like a chess match where of course you cannot undo any move.

comment 3mo ago · link · parent

If your first word is four greens it's actually pretty good: you get to know four letters to avoid with just one undo!

comment 3mo ago · link · parent

You might have misunderstood TFA. No push for trig reform, just a consideration on what internal representation is optimal in code.

Imagine it like someone suggesting (understandably) that you express memory sizes in hex: no push to make everybody stop using decimal numbers!

comment 3mo ago · link · parent

The C standard defines the functions sinpi(), cospi(), etc. that act on half-turns. If you have a modern compiler, all you have to do is to include math.h

comment 3mo ago · link · parent

Sure, it's your choice where to put your precious time. Exactly like Sheldon, you prefer not to dedicate any energy to question a judgment you have decided a priori. And like him, you might be missing out on some good stuff.
12345
32