Live data from Hacker News

C++26 is done: ISO C++ standards meeting Trip Report

herbsutter.com

371–380 of 437 posts

Re: C++26 is done: ISO C++ standards meeting Trip Report

#371

Earlier quoted context omitted.

I often see arguments like yours. I reject them wholeheartedly. Your argument is pro-poor-design. I tell you: design your software better. Design your software so that you can't have undefined behavior. It's harder, yes. LLMs suck at it, yes. But building well-designed software is a significant part of being a better engineer.

It is easier to design the software so that you don't have confusing behavior when you're not required to include behaviors you don't want. Most things do not need to be nullable. Requiring all things to have a zero value, even when they do not have one, makes it harder to be correct by construction, not easier.

> Requiring all things to have a zero value

D default initializes floats to NaN.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#372
post #265

Earlier quoted context omitted.

C++ needs to give itself up and make way for other, newer, modern, language that have far, far fewer baggage. It should be working with other language to provide tools for interop and migration. C++ will never, ever be modern and comprehensible because of 1 and 1 reason alone: backward compatibility. It does not matter what version of C++ you are using, you are still using C with classes.

Some other language need to step up and rewrite/replace LLVM then, because no language that relies on a ~30 million loc backend written in C++ can ever hope to replace it.

Zig plans to make LLVM optional. Rust has Cranelift. Go afaik has no dependencies on the C++ ecosystem including LLVM. Python and some other languages are built with C, not C++. So, progress is being made slowly to replace LLVM as the defacto optimizing code backend. Alternatives are out there, may they compete and win! C++ makes me pessimistic about the future of humanity..

Re: C++26 is done: ISO C++ standards meeting Trip Report

#373
post #114

I switched from C++ to Java/Python 20 years ago. I never really fit in, I just dont understand when people talk about the complicated frameworks to avoid multithreading/mutexes etc when basic C++ multi threading is much simpler than rxjava or async/await or whatever is flavor of the month. But C++ projects are usually really boring. I want to go back but glad I left. Has anyone found a place where C++ style programmi…

That place is C++/Lua, with most of the code in Lua. Concurrency model is thread-per-lua-state. Interthread comms is message passing implemented via textbook c++11 atomic and condition variables. Lua is just a small C library so the style remains very friendly to those who like C with classes.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#374
post #45

Earlier quoted context omitted.

To me, the most important feature of Cargo isn't even the dependency management but that I don't ever need to tell it which files to compile or where to find them. The fact that it knows to look for lib.rs or main.rs in src and then recursively find all my other modules without me needing to specify targets or anything like that is a killer feature on its own IMO. Over the past couple of years I've tried to clone and…

But you are specifying source files, although indirectly, aren't you? That's what all those `mod blah` with a corresponding `blah.rs` file present in the correct location are.

Yes and no. You're right that the mod declarations are necessary, but I'd argue that this is actually more direct (it's happening in the code, not in some external build file), and that you still aren't actually choosing where the file is located as much as stating that it's present, since you don't have the ability to look for `mod foo` in an arbitrary location, but only the places that the tooling already expects to find it.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#375

Earlier quoted context omitted.

> One of the biggest knocks against Rust as a systems programming language is that it has weak compile-time and metaprogramming capabilities compared to Zig and C++. Aren’t Rust macros more powerful than C++ template metaprogramming in practice?

No, they are not.

Incorrect.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#376

Earlier quoted context omitted.

Yeah dude but you've really marketed D poorly. I remember looking at D what must be 15 years back or so? And I loved the language and was blown away by its beauty and cool features. But having no FOSS compiler and the looming threat of someone claiming a patent (back then it was unclear that Mono/C# was "legal" and even Java hung in the balance) was too scary for me to touch it. Now I'm old and I believe D has missed…

D is 100% open source. The gnu D compiler and the LLVM D compiler were always 100% open source.

I don't recall anyone making a patent claim.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#377
post #229

Earlier quoted context omitted.

> Programming languages used for correct-by-design software (Ada, C++, Rust) ... A shoutout to Eiffel, the first "modern" (circa 1985) language to incorporate Design by Contract. Well done Bertrand Meyer!

With people still paying to get the compiler, https://www.eiffel.com

eiffel.com is a support tooling company. Eiffel the language has the website https://www.eiffel.org/>. Both sites are worth a look.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#378

Earlier quoted context omitted.

>Build everything from source within a single unified workspace, cache whatever artifacts were already built with content-addressable storage so that you don't need to build them again. Which tool do you use for content-addressable storage in your builds? >You should also avoid libraries, as they reduce granularity and needlessly complexify the logic. This isn't always feasible though. What's the best practice when o…

You can use S3 or equivalent; a normal filesystem (networked or not) also works well. You hash all the inputs that go into building foo.cpp, and then that gives you /objs/ .o. If it exists, you use it; if not, you build it first. Then if any other .cpp file ever includes foo.hpp (directly or indirectly), you mark that it needs to link /objs/ .o. You expand the link requirements transitively, and you have a build syst…

Interesting, thanks.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#379

Earlier quoted context omitted.

groans See, and that's why I'm personally fine with [[indeterminate]], etc: all of this is already a finely-splitted hairy mess and I'd rather not see even more keywords introduced if we can just use attributes instead. And yeah, it would probably be nice to also have some sane intrinsics to provide memory_order_consume semantics... but what can you do.

Consume is dead. Long live acquire! But seriously, it is interesting how C++ is completely abandoning the concept. My handwavy understanding is that on some more specialized hardware acquire is substantially more expensive than consume.

If by "more specialized hardware" you mean "everything that is not x86". Its main intended use is (was?) for chained loads and rcu_dereference(), where hardware does not require an explicit memory fence between loads like

    ldr     x8, [x8]    # load a pointer from memory
    ldr     x1, 16[x8]  # load a field through that pointer
or turning the second load into "ldar" — there is quite a visible data dependency between two registers. But compilers usually puts a barrier there anyway.

Re: C++26 is done: ISO C++ standards meeting Trip Report

#380

Earlier quoted context omitted.

Input. You are passing in a memory location that can be read or written too. That’s it.

In terms of contract in a function, you might be passing the pointer to the function so that the function can write to the provided pointer address. Input/output isn't specifying calling convention (there's fastcall for that) - it is specifying the intent of the function. Otherwise every single parameter to a function would be an input because the function takes it and uses it... I worked on a massive codebase where…

Annotation sounds good. (As long as it is enforced or honored.) which is the best you can do in C++.

A language like C# has true directional parameters. C only truly has “input”

Post reply on HN