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

All fun and games with arrays being pointers, until you declare an array in a function and return it.

Isn't this easily catchable with static analysis, -Werror -Wall? I've never had a practical problem with this.

Also arrays aren't pointers in C, they decay into pointers. You can see this since sizeof will work differently in the function that instantiates the array versus one that takes in the pointer as a parameter.


I think for most big NFL fans, they know that tanking can help, but nothing is stronger than team ownership and team culture.

The Browns are perpetually bad because their owners allow it.

Look at the Lions, new owner, completely new mentality.


It’s way easier to keep fentanyl out of drugs when you are distributing the drugs.

The government can’t regulate a black market.


The government can’t regulate a black market, but they could stop the charade of illegal drugs, convert the black market into a regular market, and regulate that. Suddenly you get less fentanyl overdoses, better outcomes for addicts (they're not criminals anymore), AND you remove the power of drug cartels (they'll still exist, but will compete with each other through less murder-y means, like any other capitalist company). Plus, stabilize a lot of third world countries where illegal drug production and export is a big part of the economy, which is what allows the cartels to fight and corrupt the state.

Or, just keep doing what they're doing. It's bound to work eventually, right? Drug cartels are definitely growing less powerful every year, the war of drugs is being won, rate of addiction is going down.


You would like to state to be in the business of permitting the sale of cocaine, heroin, methamphetamine, et al?

Or perhaps selling it directly?

Has this ever worked? Do you have any evidence whatsoever that this is a good idea?


The state is already in the business of permitting the sale of methamphetamine: Desoxyn is FDA approved.


Switzerland has prescription heroin to provide a safe supply to people addicted, as Diaphin (diacetylmorphine) 200mg. This dosage is huge and lethal for for someone without a tolerance.


I'd rather we try than give up and make a deal with the enemy.


The question in terms of memory is, will vibe coded rust get around ownership issues by .clone()-ing everything.

Maybe this has changed since I wrote Rust, but that was a classic beginner fix. Just throw memory at it.


The question to me in terms of memory is, if you're writing a weather app on windows why are you not using C#.

The point of these low/zero overhead languages like Rust is you're in an environment where memory management is ultra critical. The dotnet garbage collector does more than a good enough job for a weather app, likely a much better one than vibe coded .clone() Rust

Instead of oscillating between Rust and 1 GB webview apps just ... use the excellent managed language that exists on the operating system appropriate for GUI applications?


Now that WinUI has a Rust API, I think using Rust is a no-brainer.

The app will be running on probably about a billion of devices, and Rust will reduce the footprint on each of those - assuming not a vibe coded clone app.

The additional effort isn't that big, and it would make the experience of maaaany users a bit better still.

Now extrapolate on all windows included apps and ui elements.

How much would that cost per license?


Maybe they fired all their experienced developers and only have cheap vibecoders now, I don’t know. The decisions of beancounters and lawyers that control these companies are mysterious to me.


https://github.com/luser/keep-calm-and-call-clone

"Keep calm and call clone" is a good strategy for getting things working. Don't prematurely optimize code until you know it's the bottleneck.


There's premature optimisation, where you write a whole bunch of complicated code to avoid cloning an Arc<>. And then there's "premature optimisation" where you skip any consideration for performance until it becomes a problem.

The latter is usually what people who use the quote "premature optimisation is the root of all evil" think it means. Don't just keep calm and clone, consider what you're cloning and why, and then hopefully we won't end up with even more horribly slow software.


"Keep calm and clone" is a good advice for beginners. Then it is also a good advice for experts - because when you're an expert and you just think of cloning, that probably means it is easier than borrowing which you would default to.


By all means use borrowing if it's straightforward. But don't necessarily upend your whole codebase to avoid one clone, either.


Isn’t the latter what Knuth meant?

Such a slippery slope between “consideration of performance” and optimization.


The full quote

> Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.

Notice the aspects and the reasons for knuth's "premature optimization". Is it making the code harder to debug and read? Is it a non-critical path?

If an optimization doesn't impact readability or debugability (for example, picking a datastructure that fits the problem instead of just using a List for everything). Then you should do it.

I see the quote so often pulled by people that want to justify inserting a n^2 algorithm when a log(n) solution is either the same amount of code or 1 line extra.

There's also important context about the era knuth was programming in. Optimization in the era of knuth was targeting the hardware and tickling things like the CPU cache and memory in a very specific way. It was things like clever bit manipulation and packing to save memory. That's the context. In modern terms it'd be "don't use SIMD intrinsics until you know you need them". It wouldn't be "Don't think about algorithmic complexity" which is where I most often see that kludge deployed.


Actually they just Arc<T> everything


The other things I've seen beginners do is throw unsafe at everything.


The things that unsafe enables are arbitrary pointers, FFI, and accessing union members in a C struct. It seems highly unlikely to me that unsafe would fix any beginner's problem.

.clone() on the other hand is indeed an easy/quick fix for a lot of issues you'd face when learning rust.


I think beginner programmers are unlikely to use unsafe when learning rust but people coming from c or c++ who are beginners at rust might use unsafe all over the place.


Exactly - we have been using C or C++ for decades and most of us have a lot of experience. We think like programmers in the languages meaning we often do things that Rust won't allow without unsafe. A small percent of the time that is the right thing (which is why Rust have unsafe), but very often there is a Rust way that is just as performant if only we knew how to think like Rust programmers.


Sadly it still feels like it's one of the languages where the language doesn't trust you, it tries to force you to do things "the right way". I do love quite a few of its design like how traits are, not forcing every method into the declaration, and the standard library is much less crazy than the C++ version.

Sadly, other things a bit less so - the story for the thin battery-less stdlib + npm-style churn encourages bloat, and the semantics are obsessed with safety at a heavy cost to productivity unless you spam clone() and reference-counting - but then your program becomes slow, kind of negating the advantages, you might as well have written it in C# or something...


Yeah it doesn’t trust you, and for good reason the decades of developers making the same mistakes over and over again. If everyone was perfect you wouldn’t need Rust, but no one is perfect and that’s why Rust exists.


Most of the time the rust way is just as good, just different.


Yes, but this this is not a problem at all because any bug caused by misuse of unsafe (or unwrap) is entirely the fault of the programmer (or the AI) and not of Rust. /s


Having used it in Mexico, they usually have a suggested price that you can just pitch with, and usually people would accept that or add a tiny amount on it.


People say this and then use AI for literally everything they do.


In my experience, there's not a ton of overlap between people who say this and people who use AI for everything they do... but most people who say this do use social media, cloud storage, on-demand video streaming, and plenty of other things that rely on data centers :)

Not for nothing that YouTube alone is responsible for a double-digit amount of all internet traffic.


I think this is just projection.


Consider that there may be large populations doing both, but the overlap might be less than the internet jockey concludes via finger-in-the-wind hypocrisy check.


The interesting thing is: they don't. Most people not on HN could give two shits about an AI generated overview on Google search, in fact if you asked most people of age they'd rather have a Google Search that worked vs what we have now.

Just because the bubble here uses AI doesn't mean it's even remotely valuable for the 80%. But they've done a great job convincing a specific group of people this.


[flagged]


This is a copy-pasted comment from elsewhere in the thread, which I've already responded to. A bit much calling others "incredibly lazy".


Valid point, but this looks like (roughly) 1 billion to 5 billion in a period of 10 years.

5x in a decade. The way it’s talked about you would think it’s orders of magnitude.


Rack densities have also more than doubled just in last 5 years


It's an order of magnitude.


No it’s not. Look up the definition of an order of magnitude.


What about the constitution specifically?

You are saying this like there are other of nations that didn’t need to struggle for equal rights, workers’ right etc.


You need to ask a real question because I have no idea what you are trying to say by beating around the bush, this is about the SCOTUS which is a US branch for the US government.


This is well thought out and a good point, it does feel like though there should be some “special case” for donating land to keep for public use as a park.

You are right though, how long can someone who doesn’t own that land, have authority on how it is used.


In Seattle the city is not allowed to take away park land without replacing it with the same area of new park land. No need to special case “if it was given by a citizen to be a park” - just make it park land at the time, and it’s permanent enough.


If you want a park, then build a park. Don’t give away the land and hope someone else builds a park.


The Trustees of Reservations, in the Boston area, are a great example of this working well.


Yea, I suppose if you gave the land to an organization dedicated to building parks then you could reasonably expect to get a park out of it. Of course, they might decide to build a garage to house and maintain their fleet of mowing and gardening equipment instead.


Maybe a bit out of scope for this article, but seems like in every country “Younger millenials and Gen-Zers” are turning to gambling online while traditional gambling (like Vegas) dies.

I feel like this might be a net negative from the pure speed and access in which you can lose money online vs real life, but idk.


Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: