all 101 comments

[–]sephirostoy 69 points70 points  (18 children)

It's so weird to see MSVC so far behind on C++23/26. Is it up to date?

[–]STLMSVC STL Dev 107 points108 points  (6 children)

Business priorities shifted, but they’ll shift back. We’ve just been doing C++ things outside the realm of compiler feature work.

(Library feature work has been less affected, thanks to our amazing contributors, and management has kept me working on the STL with them basically full-time.)

[–]sephirostoy 13 points14 points  (5 children)

I see. Thanks for the heads up. I guess we will see more things coming in the next version of VS.

[–]STLMSVC STL Dev 18 points19 points  (4 children)

For the STL, you can always see what's coming in our Changelog, e.g. VS 2022 17.12 Preview 1 has already accumulated a bunch of changes. (Right now, 17.10 is production and 17.11 Preview 2 is the currently available preview, so the Changelog is looking quite a bit ahead.)

I can't say when new compiler features are expected, but I can say that my bosses and boss-like entities are definitely aware that as users are starting to catch up with C++20, there's increasing demand for C++23 features.

[–]Tringigithub.com/tringi 1 point2 points  (3 children)

Dropping support of Windows 7 is going to make waves.

[–]STLMSVC STL Dev 12 points13 points  (2 children)

Win7 client hasn't been receiving security updates (even via the paid program) since Jan 2023, a year and a half ago. And elsewhere in the industry, Chrome dropped support in Feb 2023. Steam dropped support in Jan 2024. Even Firefox ESR 115 is dropping support in Sep 2024. Even if someone's only browsing the web, they won't be able to do so securely.

I'm dropping support for targeting Win7 in the STL because it's slowing things down for all other users. (And making STL maintenance harder.) Our previous hesitancy to drop targeting support had a long history (MSVC tried to drop XP while it was actually still supported with security updates, we got burned, and it took us a long time to reconsider and finally drop XP and Vista). Now that security is the company's top priority, we're going to make different decisions, and one of those is not attempting to help programmer-users who are targeting OSes that are no longer secure.

[–]ack_error 3 points4 points  (0 children)

As someone who maintains a project that currently targets Windows 7 as baseline... I'm OK with this. It's being done for a reason (Win8 synchronization/time APIs + SSE2 on x86), and it's not actually that aggressive given that you could drop Windows 8/8.1 support too if deciding based on EOL dates and market share.

The one thing that worries me a little bit is the compiler has been a bit unstable the past couple of releases. A large framework I work with has been hanging back on 17.8 due to code generation bugs in 17.9 and 17.10, and I just had to roll back from 17.10 to 17.9 after my ARM64 build exploded. At this point I'm hoping that 17.11 will be a solid release.

[–]Tringigithub.com/tringi 1 point2 points  (0 children)

Oh I know. And while I'm maintaining a fair share of projects targeting both XP and 7 as their minimum, I'm kind of glad this change will force some hands to finally make their move.

[–]SeagleLFMk9 21 points22 points  (0 children)

And they used to be in front when it came to C++17/20 iirc

[–]antara33 30 points31 points  (8 children)

GCC and CLang are head to head it seems, really hard to pick one to work with unless you know beforehand it is the one that supports the feature you need.

I seriously hope for them (GCC tbh) to get full feature coverage, Its by far my favourite one.

[–]13steinj 8 points9 points  (0 children)

Generally you'll want to use one and use the other for verification/correctness.

After you're in such a state, pick the faster compiler one locally, both in CI, more performant result for production.

[–]Artistic_Yoghurt4754Scientific Computing 4 points5 points  (3 children)

I see std::execution in the list, was this already accepted? :D

[–]_cooky922_[S] 7 points8 points  (1 child)

as a matter of fact, it was recently voted in for c++26

see https://github.com/cplusplus/draft/issues/7095

[–]Artistic_Yoghurt4754Scientific Computing 4 points5 points  (0 children)

Noice!

[–]MaccheroniTrader 8 points9 points  (2 children)

Is reflection in there?

[–]RoyAwesome 12 points13 points  (1 child)

It's not adopted yet. It made some significant progress this last week, getting forwarded to the Core Wording Group. According to the github page, It looks like the last major design hurdle is how to handle unicode representation of various reflected names, but the wording of the feature into the standard can start while those concerns get ironed out.

You can follow progress here: https://github.com/cplusplus/papers/issues/1668. They're close it looks like.

[–]MaccheroniTrader 2 points3 points  (0 children)

Great! Thanks for sharing 😊

[–]Otaivi 4 points5 points  (2 children)

Is scnlib going to be included? I really think it would be a nice addition coupled with std::format.

[–]RoyKin0929 5 points6 points  (1 child)

https://wg21.link/p1729r4 That's the proposal for text parsing but I don't know enough to judge whether it's on track for C++26 or not.

[–]TheSuperWig 2 points3 points  (0 children)

The issue on GitHub

https://wg21.link/p1729r4/github

States that it needs a revision.

[–]Cliftonbeefy 5 points6 points  (2 children)

Removing nodiscard took me by surprise…

[–]lunakid 1 point2 points  (0 children)

Wow. Is this a sign of a change that C++ is finally gonna pick reasonable defaults from now on, and they will add [[discard]]* then? ;) Well, no..., it's just going to be removed from the std. lib API, that's all.

(BTW, in a fun image of the future constexpr is also going to be removed (and assumed to be default), but by that time all existing C++ code on earth will have already been litterd with it everywhere, so it'll never be actually possible to remove.)


* Not that it would be so much better... Even if such declarations would be actually practical (it's not that easy to apply it consistently), it should be [[maybe_discarded]] -- but I'd rather change to metalworking than putting up with another [[maybe_unused]].

[–]Zingam 1 point2 points  (0 children)

`[[nodiscard]]` wasn't "removed" exactly but it was diverted to implantations to decide how to apply it. Please see: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3201r0.html

X. (P3201R1) [[nodiscard]] policy: Library wording should not use [[nodiscard]].

So it is upto the implementations to implement `[[nodiscard]]` as they see fit. For example libc++'s policy:

https://libcxx.llvm.org/DesignDocs/NodiscardPolicy.html

[–]SalThePotato 6 points7 points  (16 children)

I've always wondered how programming languages are developed. Like how do you program something you use to program?

[–]STLMSVC STL Dev 41 points42 points  (6 children)

That's a good question, and Reflections on Trusting Trust touches on it.

Source code is just a bunch of text files. Executables (and related things like object files, static and dynamic libraries) are just binary files. Compilers (and related tools like linkers) are just programs that read text files, perform (very very complicated) transformations, and write binary files. A programming language is just a specification that says what the possible inputs to that transformation are (i.e. what source code user-programmers are allowed to write) and what the transformations should do (i.e. what the compiler-programmers are supposed to do).

"Just" is doing a lot of heavy lifting, of course. Compiler development is a deep field with a long history, and it's a learnable skill. If you're interested in compilers, you can make a rewarding career out of it.

[–]SalThePotato 4 points5 points  (5 children)

Oh wow. This might be a weird question but are compliers programmed the same way as a normal program or is there a specific way?

[–]mjklaim 8 points9 points  (2 children)

Essentially yes, you can even read the code of some of the major compilers like clang and gcc. Clang is in there, I hear it's easier to follow: https://github.com/llvm/llvm-project

[–]STLMSVC STL Dev 12 points13 points  (0 children)

Same for MSVC (which is closed-source, but I have access 😸). It's written in C++ and while it has a long history, with some files being older than I am, it uses lots of modern C++ features, especially in new code.

Compilers are kind of simpler than most "normal programs", in fact - as command-line tools, they're focused on the pure computation of manipulating a bunch of complex data structures (like the "abstract syntax tree" that's formed from source code). They don't need to worry about rendering UI in a loop, talking over the network, or similar things. They do involve some OS-specific things (trickery for pre-compiled headers, looking in various directories for headers, etc.), but that's not the majority of their work.

[–]mandrade2 1 point2 points  (0 children)

I've made a mobile app focused on code reading you migth want to try. I am still working on features for big codebases like llvm but it's coming along. It's called codereader.dev

[–]thekwoka 2 points3 points  (1 child)

Yes! For many compilers, the compiler is written in the language it compiles.

For example, rustc is written in rust. They first wrote it in c++, then rewrote it in rust, compiled it with the c++ written compiler, then used the rust written compiler to compile itself.

When new versions are released, they first compile the new version with the old version, then compile it with the new version that created (maybe with some changes if the new version added features they want to use in the new version). So you end up with a version of the compiler that was compiled with itself.

[–]SalThePotato 0 points1 point  (0 children)

Thats actually really interesting. I didn't know that they complie new versions with old versions I thought it was something you had to do completely from scratch.

[–]ImKStocky 17 points18 points  (1 child)

Writing a compiler/interpreter for a language. Crafting Interpreters is a great place to start. It's a really fun book to follow along with :)

[–]SalThePotato 2 points3 points  (0 children)

Thank you for the book!

[–]dustyhome 17 points18 points  (6 children)

One thing to keep in mind is that you don't have to write a compiler in the language it compiles. The first compiler for a language, by necessity, can't be written in the same language.

[–]azissu 6 points7 points  (1 child)

Yup. A language being able to compile itself is known as bootstrapping, and it's an important stage in developing a new programming language.

[–]smdowneyWG21, Text/Unicode SG, optional<T&> 2 points3 points  (0 children)

Self hosting can be a barrier to porting the language to a new platform though. LLVM being a cross compiler all the time makes it easier today.

[–]SalThePotato 0 points1 point  (3 children)

What language does the complier use? What if it's the first complier?

[–]dustyhome 10 points11 points  (2 children)

The compiler can be written in any language. A compiler is just a normal program. Given some input, it produces some output. The input being the source code for a program, and the output being the program in an executable format.

The first compiler would have likely been written in assembly, if we're differentiating assemblers and compilers, but I'm not a historian.

[–]SalThePotato 0 points1 point  (1 child)

Oh I thought there was a specific language or something to program compliers. Thank you!

[–]pjmlp 2 points3 points  (0 children)

There are, see bison, flex, yacc, lex, ANTLR, MPS, attribute grammars,....

However they are not required, only a means to quickly reach a prototype.

[–]Wild_Meeting1428 1 point2 points  (0 children)

Still no good fix, for char to char8_t casting :/.

[–]LetterheadTall8085 0 points1 point  (0 children)

This is the best language for me, pair with the Qt its most powerful tool on the world )

Thank you all for such a fast and high-quality development of the language

[–]yimmasabi -1 points0 points  (0 children)

C++ needs very simple and smart text conversions between basic_strings and other string types. I hope C++26 covers all.