Live data from Hacker News

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

herbsutter.com

301–310 of 437 posts

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

#301

Earlier quoted context omitted.

Because you can't adopt that syntax after the fact. there is 30 years of C++ in the real world, initializing everything by default unless you opt-in will break some performance critical code that should not initialize everything (until it is updated manually - it has to be manual because tools are not smart enough to know where something was intentionally not initialized 100% of the time) Thus the current erroneous.…

> there is 30 years of C++ in the real world, initializing everything by default unless you opt-in will break some performance critical code that should not initialize everything ...But the change to EB in this case does initialize everything by default?

No it doesn't. It says the value is unspecified but it exists. Sometimes some compilers did initialize everything (this was common in debug builds) before. Some of them will in the future, but most won't do anything difference.

The only difference is some optimizer used to eliminate code paths where they could prove that path would read an uninitialized variable - causing a lot of weird bugs in the real world.

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

#302
post #288

Earlier quoted context omitted.

if something so simple needs years of experience it's poorly designed

Modules are not simple. They sound simple only to people who have never digged into them.

I've worked extensively on module/import semantics for multiple products in my life. It is complex. However this complexity is on the implementer and not the user.

If "best practices" need to be refined over years, it is poorly designed. This is not untrodden ground, other languages and ecosystems do sane things.

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

#303

Earlier quoted context omitted.

No idea if modules themselves are failed or no, but if c++ wants to keep fighting for developer mindshare, it must make something resembling modules work and figure out package management. yes you have CPM, vcpkg and conan, but those are not really standard and there is friction involved in getting it work.

I emphatically agree. C++ needs a standard build system that doesn’t suck ass. Most people would agree it needs a package manager although I think that is actually debatable. Neither of those things require modules as currently defined.

That is not even half realistic. Are you going to port all that code out there (autotools, cmake, scons,meson, bazel, waf...) to a "true" build system?

Only the idea is crazy. What Conan does is much more sensible: give s layer independent of the build system (and a way to consume packages and if you want some predefined "profiles" such as debug, etc), leave it half-open for extensions and let existing tools talk with that communication protocol.

That is much more realistic and you have way more chances of having a full ecosystem to consume.

Also, noone needs to port full build system or move from oerfectly working build systems.

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

#304

If you ask me (and why wouldn't you? :-)...) I really wish the C++ WG would do several things: 1. Standardize a `restrict` keyword and semantics for it (tricky for struct/class fields, but should be done). 2. Uniform Function Call Syntax! That is, make the syntax `obj.f(arg)` mean simply `f(obj, arg)` . That would make my life much easier, both as a user of classes and as their author. In my library authoring work pa…

I think you cannot get an idea of in hiw many ways 2. can break...

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

#305

Earlier quoted context omitted.

GCC has it marked as 'RESOLVED FIXED' as of about a week and a half ago. So, it's coming. Also, useful: https://gcc.gnu.org/projects/cxx-status.html

Support in GCC isn't what limits my usage of latest C++ at work.

Clang also isn't too far off of GCC on support, so if you're not using either of those, my condolences. And if it's management mandate, god help us all.

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

#306

Earlier quoted context omitted.

D initializes all variables. If you don't provide an initializer, the compiler inserts the default initializer for it. But if you really, really want to leave it uninitialized, write: int x = void; where you're not writing that by accident.

> If you don't provide an initializer, the compiler inserts the default initializer for it. This requires that there is a default. Several modern languages (such as Go) insist on this, it means now your types don't even model reality in this very fundamental way. Who is a person's default spouse? Even where you can imagine a default it's sometimes undesirable to have one, for example we already live in a society wher…

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.

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

#307
post #129

Earlier quoted context omitted.

The dynamic linker can clearly tell you where it looks for files and in which order, and where it finds them if it does. You can also very easily harden this if you somehow don't want to capture libraries from outside certain paths. You can even build the compiler in such a way that every binary it produces has a built-in RPATH if you want to force certain locations.

That is what I'm doing so I can get distributed builds working. It sucks and has taken me days of work.

It's pretty simple and works reliably as specified.

I can only infer that your lack of familiarity was what made it take so long.

Rebuilding GCC with specs does take forever, and building GCC is in general quite painful, but you could also use patchelf to modify the binary after the fact (which is what a lot of build systems do).

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

#308

Earlier quoted context omitted.

No. Neither in the language (NULL exists) nor necessarily on real CPUs.

NULL exists on real CPUs. Maybe you meant nullptr which is a very different thing, don't confuse the two.

I don't agree. Null is an artefact of the type system and the type system evaporates at runtime. Even C's NULL macro just expands to zero which is defined in the type system as the null pointer.

Address zero exists in the CPU, but that's not the null pointer, that's an embarrassment if you happen to need to talk about address zero in a language where that has the same spelling as a null pointer because you can't say what you meant.

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

#309
post #11

I am somewhat dismayed that contracts were accepted. It feels like piling on ever more complexity to a language which has already surpassed its complexity budget, and given that the feature comes with its own set of footguns I'm not sure that it is justified. Here's a quote from Bjarne, > So go back about one year, and we could vote about it before it got into the standard, and some of us voted no. Now we have a much…

C++ isn't the first language to do things, but was/is often the first mainstream language to do things.

And then people complain about C++ for doing it wrong, or its complexity, and show language 'X' that does it better/right, but only because they saw C++ do it first, and 'not quite right'.

I expect contracts to be similar - other languages will watch, learn, and do version two, and then complain about c++, etc.

It took 'quite a while' to get rid of auto_ptr, for example.

If it wasn't for the fact this is a language feature, it would be better off in boost where it can be tested in the wild.

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

#310
post #293

Earlier quoted context omitted.

> If you don't provide an initializer, the compiler inserts the default initializer for it. This requires that there is a default. Several modern languages (such as Go) insist on this, it means now your types don't even model reality in this very fundamental way. Who is a person's default spouse? Even where you can imagine a default it's sometimes undesirable to have one, for example we already live in a society wher…

I don’t care that much about everything having a default (although it’s nice), but if a language insists on a default value for every type for safety, can’t you just use std::optional?

I can't tell if you imagine std::optional is a value (it is not) or if you know it's a templated type but you imagine that somehow it would be OK to redefine all programs so that every type is std::optional of that type instead so as to simplify initialization.

Either way no, that can't work.

Post reply on HN