Better HN
topnewbestaskshowjobs
Log inSign up

spacechild1

3,569 karma · joined May 28, 2017 (9y ago) · 1,790 submissions

Submissions

comment 1d ago · link · parent

As if Trump had not already provided enough impeachment material...

comment 1w ago · link · parent

> They _can_ make it more readable.

Fair enough!

comment 1w ago · link · parent

> I also love C++11 "auto", but overusing it then makes the string/string_view bugs harder to find.

Yes, I have soured a bit on the "almost always auto" mantra myself. There are cases where explicit types are both clearer and safer.

comment 1w ago · link · parent

Most of the features I have listed make the code more readable, which I would count as more maintainable. None of them have a runtime overhead.*) In fact, `<format>` and `<charconv>` are significantly faster than their counterparts.

Personally, I don't use any modern C++ features just for the sake of it. That would be silly indeed! For example, I have never used ranges/views because I don't find them particularly compelling, at least for things I do.

*) Creating a coroutine frame typically requires a heap-allocation, but so does the old ASIO callback style.

comment 1w ago · link · parent

Exactly! When you have a `const std::string&` argument, passing a C-string implicitly allocates a new temporary `std::string`.

`std::string_view` accepts both `const std::string&` and `const char*` without hidden allocations.

comment 1w ago · link · parent

> What does behave like a std::string/std::vector but is not std::string/std::vector, respectively?

`std::span` works with all vector/array-like types: `std::vector`, `std::array`, C-arrays and third-party vector/array types.

Similarly, `std::string_view` works with `std::string`, C-strings and third-party string types.

> so that the autovectorization can kick in

It's not even about vectorization. Often you just have a function that takes a string-like or array-like thing, but you don't care about the exact container. Yes, you could make the argument a template (and constrain it with concepts), but then you have to put everything in headers.

comment 1w ago · link · parent

`string_view` (and `std::span`) is great! Finally I don't have to use concrete types like `const std::string&` or `const std::vector<float>&` as function parameters when all I really want is just something that behaves like a string or array/vector type.

In fact, `std::string_view` can lead to very elegant and efficient (zero-allocation) string parsing code.

IME, taking a string_view as an argument is pretty unproblematic. Two areas where I have seen problems:

1. returning a string_view from a function. Think twice before doing that.

2. calling data() and passing the result to a function that expects a null-terminated C strings. (std::string_view is not guaranteed to be null-terminated.)

---

Apart from that, there are so many great features and libraries in C++17 and C++20 that I use on a regular basis and that I would really miss:

- structured bindings

- if-statement initializers

- fold expressions

- inline variables (very useful for handling global state in header-only stuff)

- if constexpr (replaces many uses of SFINAE)

- concepts (replaces all of the remaining uses of SFINAE)

- coroutines (really nice to use with ASIO)

- std::optional

- std::variant

- std::filesystem

- std::format (although I personally stick to fmt::format)

- from_chars() and to_chars() (fast, local-independent string-number conversion routines)

- std::bit

- std::apply, std::invoke, std::bind_front

- etc.

comment 1w ago · link · parent

> This filing clearly shows that the training+inference margins are at around 43%.

Subscriptions or API pricing? There is no doubt that the subscriptions are heavily subsidized. They just milk it with their API pricing.

And of course we have to assume that they didn't use any dubious accounting tricks to make them look more profitable.

comment 1w ago · link · parent

Yeah, the irony of that is definitely not lost on me...

comment 1w ago · link · parent

> human understanding does not decrease, it just moves up a level or two.

It absolutely does. You lose understanding of the code, but what kind of understanding do you actually gain in turn? AFAICT it is purely a tradeoff between velocity and understanding.

comment 2w ago · link · parent

> And if the texts I generate turn out shit they won’t make it to the reader, right? Natural selection.

If that was only the case. Sadly, that's not how the internet works...

comment 2w ago · link · parent

In many open source software projects.

comment 2w ago · link · parent

I can't speak for commercial software development, but that's very much not true for open source software. Personally, I don't want to use software that is a black box. That's the reason why I'm using FOSS in the first place.

Another note: some software has a history of multiple decades. In fact, I happen to work on such software. IMO it would be irresponsible to turn the code into an incomprehensible slop fest just because some AI boosters want me to believe that "coding is solved" or "software is dead".

comment 2w ago · link · parent

Unfortunately, it's not only big tech companies... but it's especially infuriating when it comes from a billion or trillion dollar company. As if they don't have the money to hire a professional illustrator.

For me there is almost nothing more grating than obvious AI illustrations. It makes it near impossible for me to take the content seriously. I'm wondering: do these people just have no taste? Or do they think nobody cares? Or they just don't care themselves?

comment 2w ago · link · parent

> It’s just that I don’t.

Then why are you writing blog posts? Why actively contribute to the avalanche of slop that is hitting the internet?

comment 2w ago · link · parent

I sincerely hope you were taking the piss with that first paragraph.

> Not sure why people hate so much AI generated text if it makes sense.

1. It says you did not put much effort in it

2. It is grating to read

3. It's dehumanizing

comment 2w ago · link · parent

I think you completely missed the point. If the work becomes faster, you need to get more work done per hour than before. The work has been redefined, but so have the expectations.

comment 2w ago · link · parent

If you only access members, the version is not necessary. The receiver of the struct checks which members are present and ignores extra members that it does not know about. That's backward and forward compatibility.

The version could be useful if some members change their meaning across versions. But this would mean that you couldn't use a struct made from a future version because you wouldn't know about potentially changes.

Personally, I have only seen version or size, but not both. Do you have an example?

> It also helps if you only append to the end of the struct for newer fields.

This is actually required because changing or reordering existing members is an ABI break. Unless every version has its own dedicated struct. (This is often done in COM like APIs where interfaces are extended by adding a new interface. The client queries the must recent interface it knows about; if not supported, it tries the previous interface, and so on until it succeeds.)

comment 2w ago · link · parent

You are right. However, I would argue that semantically the "do" is part of the negation.

Actually, you can do the same in German ("Ich tu nicht essen" -> "I do not eat"), but it's very colloquial and "forbidden" in writing. The proper form is "Ich esse nicht".

comment 2w ago · link · parent

Seems like you make best out of it :)

comment 2w ago · link · parent

Yes, but if I only use the excavator for 5 minutes and coast the remaining 55 minutes, I'm less useful than someone who uses the excavator the whole hour. Now, if I'm particularly skilled at using the excavator compared to my peers, I might get away with working less. If not, working 5 minutes while charging for 60 minutes will eventually get me fired.

Generally, automation does not make us work less because the expectations rise equivalently.

comment 2w ago · link · parent

How long it will it take your employer to figure out that your hours are really only worth a fraction of your current rate?

comment 2w ago · link · parent

Software developers need to realize that their app is not the only one that will be running on the user's computer. A single app taking 300 MB of RAM? No problem. 20 apps? That's already 6 GB of RAM.

And keep in mind we're talking about a damn chat client, not some complex video editing or CAD app.

comment 2w ago · link · parent

This gave me a good laugh. Like, who could have known?

There's absolutely no reason why a simple chat client should take more than a fraction of a second to start. If you need to fetch data from the web, just do it progressively. Not to mention that 290 MB is still way too much.

It's ridiculous how over the last 20 years simple apps became slower and slower while computers became faster and faster.

At the same time, REAPER (a full digital audio workstation) opens in less than a second.

These so-called software engineers seem to have completely lost the baseline of what is possible on modern computers. Or they just don't care.

comment 2w ago · link · parent

FWIW this is exactly how you negate a verb in German. For example: "Ich rauche nicht " -> "I don't smoke" or "Ich brauche keinen Mantel" -> "I don't need a coat"

comment 2w ago · link · parent

One example that comes to my mind is libopus: https://github.com/xiph/opus

If you have structs that might need to be extended, you can use "versioned structs". One popular technique is to include the struct size as the first field. The struct size is set to `offsetof(mystruct, lastmember) + sizeof(lastmember)` and the receiver of the struct can use this to check if a member exists. The ARA API is a good example: https://github.com/Celemony/ARA_API/blob/65ec5c43b943a48cb54...

comment 2w ago · link · parent

You're still reading code in 2026? /s

comment 2w ago · link · parent

Ugh...

comment 3w ago · link · parent

That's pretty rich coming from you.

comment 3w ago · link · parent

No, thanks. You should have done more research before making your initial ridiculous claim. Don't throw economy papers at me when it's very clear you don't know what you're talking about.
12345
60