Hacker Newsnew | past | comments | ask | show | jobs | submit | BobbyTables2's commentslogin

I’m just amazed there are companies actively grooming employees to be promoted.

In my experience, rarely an individual contributor ends up being promoted to a manager (because the latter retired/layoff/etc).

At the higher levels, they are filled with executives in acquired companies or hired from the outside. (CEO of LittleCo becomes VP of BiggerCo)

Although I have seen 2-3 unicorn cases where someone goes from janitor to director in 3 years - far faster than a high performing junior engineer with demonstrated accomplishments can become a senior engineer… Always assumed the former was flat out nepotism.


I feel like any company whose products have RESTful interfaces are already there…

One wants to turn on an indicator on a remote device. A simple Boolean value. But we need networking, TLS, authentication plugins, certificate validation, distributed logging, containers, orchestration, HTTP client/server, interprocess communication, daemon dependency management, …

Sure, one can say each of these layers and abstractions has an important and justifiable purpose. But one can also step back and start wondering - what the hell are we really doing???

At some level, it seems like each layer of abstraction has to manage others, only simply because they exist.

Imagine the simplicity of 1800s telegraph signaling - no software!

Too often we build systems with Fortune-50 style hierarchies when a 5-person team could do the whole job.


Build a system as simple as possible but no simpler.

An 1800s telegraph system doesnt work in the modem world, there is far too much communication and the system would just collapse into molten slag.

All those things you've listed are because we live in an adversarial world and I'd steal all your money off the telegraph wire if you tried it.


Kind of like analogue TV. Sure it worked and was simple, but consumed some prime spectral real estate.

Having worked in hardware for a moment, everything we do in software is like this. Even C.

There are a whole series of blog posts from the Fishworks guys explaining why it could possibly be so hard to turn on one LED.

But Oracle probably deleted then so you'll have to find them on archive.org.



It’s also a quite a shock as the property value doubles over a short time (which happened in the past few years).

Counties are very aggressive at updating appraisal values.

Property tax used to be deductible for Federal income tax purposes but effectively no longer — from a bizarre effort to spite the “blue” states.


For a long time, the movie “War Games” while entertaining, also seemed a bit absurd.

Doesn’t seem so absurd anymore…


After 2012 or so someone turned up the absurdity level of Earth to 11. Damn Mayan calendar must have been keeping a lid on it before then.

It's probably in the training data somewhere, maybe in multiple places.

If users ask ChatGPT questions about that movie, it has to answer them, after all.


TLDR: For almost 1/6 of a century, the C++ standards broke the simplest infinite loop and only just recently fixed it.

Idiots!

Don’t they really that people write real programs to solve real problems? This isn’t a theoretical academic exercise!


The argument is that an infinite loop without side effects isn't a real program. It's not useful for anything except wasting cycles.

Of course the infinite loop should run as expected.

It breaks the most fundamental debugging expectations (such as "delete code until problem disappears") if the fundamental, minimal building blocks of a language, when on their own, do random rubbish.

To understand a program that does something, better first understand a program that does nothing.

As a fan of sensible analogies:

You put a salad bowl with vinegar into the fridge and notice that when you do that, the fridge stinks afterwards. You try again without the vinegar, then without the salad. In C++ world, upon receiving the empty bowl, the fridge detonates ("it is not useful"), blowing up your house. That is not OK.


But if you program a for loop computing the sum from 1 to n, this also gets replaced by a constant (unless you build in debug mode). Why would an empty loop be different?

I think the argument is that the equivalent of an infinite loop would be a halt / abort instruction, not a complete removal of the loop and continue running anything else.

Not necessarily what you want in that case either: it's a common pattern in cases where you want the system to halt until you can attach a debugger to inspect the state. A halt/abort instruction that trashes that state would be undesirable (some CPUs have an instruction that is equivalent, but many do not, after all, why bother if you can just write an infinite do-nothing loop?).

A halt instruction is probably the appropriate representation for an infinite loop - the process gets stuck same as the infinite loop without proceeding. Abort is the instruction you want unreachable() to compile down into. It wasn’t an either or but both depending on the specific behavior you want.

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.


I'm not sure what this has to do with my comment. I am aware of all of this. It would be nice if an infinite loop was defined to be 'do nothing, indefinitely'. On architectures with an instruction that works that works precisely that way, it could be turned into that, perhaps, but that's an implementation detail and should follow the as-if principle (I'm also not sure any compiler would bother).

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


And unfortunately that argument would be incorrect, because not only is there a realistic chance of hitting this on embedded systems, the fact that LLVM baked this into its low-level semantics resulted in miscompilations in Rust for a time, where `loop {}` is a valid way to implement a diverging function: https://github.com/rust-lang/rust/issues/28728

Yeah the argument here is clear, also rather silly. Either you must accept that your language allows for completely useless computation, or, if the compiler is so good at detecting "unreal programs" it should also refuse to compile them.

They also realized that people choose compilers based on performance benchmarks, and that insane optimizations let them win.

Until Rust proved actually you can get really good or better performance if the language itself is better. I really don’t know how C++ digs itself out of the UB hole it has dug.

Probably by working together with Rust. Eliminating undefined behavior from unsafe Rust is a big deal for the Rust community at the moment. And given that most unsafe rust code exists to call into C or C++, concepts like pointer provenance need to be extended. And proper pointer provenance guarantees can both decrease UB and increase optimization potential.

IIUC, my understanding is shallow.


That's a niche level thing that helps in some scenarios, and generally not as much for C++ which is much more weakly typed than Rust is. Weak typing + static typing is why safety problems in C++ are going to be really difficult to fix without fundamentally changing the language.

I expect some changes to the language from this direction, some way to attach provenance information or limitations to a pointer. Presumably through a #pragma at first. Strict typing in the C++ sense, not the Rust sense. An annotation like "volatile".

Pointer provenance is just one example, there are others.


This particular case is likely an example of that. Rust used to have this problem, but it wasn't ever intended to. So IIRC it got fixed in LLVM for Rust, and this is probably now C++ taking advantage of that.

> the simplest infinite loop

An infinite loop which does nothing is practically useless. So, compilers optimize it out. That's the whole philosophy of modern compilers - to reduce execution time by preserving semantics. In case of an infinite loop elimination it's an optimization making code infinite times faster.


But also very different. If code below this loop executes after elimination and wouldnt have before, that is a very significant change in semantics

You are an idiot if you write an infinite loop. An infinite loop is a waste of CPU cycles and energy when run.

If it wasn't so hard to detect (the trivial cases are easy, but it gets hard quickly) I'd say the program should fail to compile.


And where to you think all that "wasted" energy/cycles would go otherwise? Why do you presume there's some other, more efficient way the CPU could be spending its time while waiting for an event to process?

I, the programmer, will decide what cycles are wasted or not. That the C++ committee thought they knew better is hubris.


If the CPU halts it isn't used at all. If the CPU does an infinite loop then it all goes to heat.

If the loop is doing anything then it cannot be optimized away. Only loops with no side effects meaning they are just turning the CPU into a heater count.


And how would you generate assembly to keep a microcontroller idle then?

You call the CPU halt instruction.

What if my CPU doesn't have that? I don't think Atmel Microcontrollers do for example.

Better CPU selection. Embedded almost always have power requirements and you need to put your CPU into a low power mode not a loop which is running fast. You can also design your hardware such that you can turn the power off completely in these cases (or perhaps reboot).

Now that I think of it, a different project (I worked just down the aisle, but I wasn't on it) solved a lot customer complaints by turning all the "while(1);" loops into blink an error code - which since it does IO is defined behavior. Which probably is the correct answer to your question - don't just spin doing nothing, spin in such a way that the user has a clue why nothing is working (and in turn you can find out and perhaps fix real world bugs)


This is myopic. In many cases it takes time, and sometimes considerable programming effort, to enter and exit low power modes. So you don't do it willy-nilly; you do it when you believe the system has quiesced. That means, on a purely interrupt driven system that is not yet ready to sleep, the code may very well be spinning in an empty infinite loop somewhere.

There's no need to inform the "user" because there's nothing wrong with the system. Its simply waiting until the benefit of sleeping outweighs the cost of getting there.


The context here is an infinite loop with no side effects. You have all the time needed to enter those states.

It may take 100s of instructions to enter a deep sleep state, and 100s to 1000s more to exit it. If you anticipate having to service an event sooner than that, you don't enter sleep at all (especially since there's likely a point at which you're committed to sleep, and have to go all the way down in order to come right back out again). Instead, you hang around twiddling your thumbs until the event comes along.

Now if your processor has a halt/wait-for-interrupt instruction (most do but some don't) you can escape into assembly and use that. But it probably makes little to no difference to energy utilization, and of course its not portable. A nice while (true); would seem obvious, except that the C++ committee insisted that it wasn't.

Just one example of where the committee lost sight of the fact that it was defining an imperative programming language.


Not necessarily, you could also want to make an infinite loop and wait for an interrupt without eanting to power down.

AVRs have SLEEP instruction.

Non-trivial infinite loops are very much not an "idiot" thing on embedded systems. "Run until power off" or "run until the warhead detonates" are perfectly normal things to do in that world.

We’ll circle back, launch our go to market strategy, and chase the lightning for a win…

I had a former colleague who would put a “retry 10x with sleeps” in each of A, B, C, D.

None of these were even expected to fail. But the code was buggy as well, so after D being retried 10000 times, it’d eventually give up. Managed to convert a sub-second operation into a half hour affair.



Suspect it’s far more than $80/month - I was paying that much for a small unit about 30 years ago! (In a LCOL area too!)

I paid around that for a 5x10 unit in a medium sized midwestern city for a year during covid when I worked fully remote and moved back to my parents' house for a year.

But can you put dishes with food on them in the dish washer?

Yes.

I detect SPAM.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: