5 ms·
I'm curious if these new additions to C++ have genuine use cases (as in we could not do this because X) or if there are more academic driven arguments going on
by botto 5y ago
I'm curious if these new additions to C++ have genuine use cases (as in we could not do this because X) or if there are more academic driven arguments going on here.
Having recently done a lot of work using C++ previously coming from Go and Typescript I find it hard to understand all the reasons for the language to be so flexible.
- zabzonk 5y agoMost of the language additions are aimed at library designers and writers, where they can give significant performance and ease-of-use improvements, rather than at C++ application developers.
- jackosdev 5y agoI don't see any mention of std::format, it's great for app developers, I don't think any compilers support it yet though. It's pretty much just the fmt package that you can use now.
- pjmlp 5y agoNot really, it is a subset of fmt.
- zabzonk 5y agoIt's a library addition, not a language addition.
- colejohnson66 5y agoWell, yes, but it was added in the C++ standard. I guess the standard covers the language and the library, but to me, the standard library is part of the language.
- jcelerier 5y agoit's part of the language, but not of the core language
- catblast01 5y agoThis is really a false/meaningless distinction though. The C++ spec covers the “language” (it’s one of the first sentences), and that includes the standard library. The spec uses the terminology language and library but there is no formal distinction between them other than how they’re organized in the spec. A conformant compiler could implement the entire STL as a built in if it wanted to. There is a formal distinction between hosted and freestanding, but that’s not the same as library/language. Cf https://en.cppreference.com/w/cpp/freestanding https://en.cppreference.com/w/cpp/freestanding I really don’t care for pedantry, but when people start correcting others then had better be right.
- jcelerier 5y agoLet me quote the standard then: [intro.structure] Clause 5 through Clause 15 describe the C++ programming language. That description includes detailed syntactic specifications in a form described in 4.3. For convenience, Annex A repeats all such syntactic specifications. Clause 17 through Clause 32 and Annex D (the library clauses) describe the C++ standard library. That description includes detailed descriptions of the entities and macros that constitute the library, in a form described in Clause 16. it's pretty obvious from that than the library is seen as separate from the language - and yes, std:: could be entirely built-ins but as always that'd be under the as-if rule of optimization. Else what would be the meaning of core language defects ? http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html
- catblast01 5y agoI think I addressed that: “how they’re organized in the spec”. They’re distinct, but outside of internal references in the spec the distinction between language and library doesn’t really matter. To a user of C++ it’s all one spec with distinctions for freestanding and hosted implementations, etc. You can’t have a conformant C++ implementation without elements from both. The original point of this thread was about where std::format exists and from a implementation point of view it doesn’t really matter.
- synergy20 5y agovery informative, for application developers probably the basic syntax, plus STL are enough to start, instead of chasing modules/concepts which are great to have, but adds complexity for certain c++ users(e.g. application developers). STL containers and algorithms are the true gems from c++, paired with the speed and memory efficiency and smart-pointers, c++ is just getting stronger these days.
- botto 5y agoThis makes sense! Thank you
- Const-me 5y agoFor practically useful stuff, there’re lots of nice things in the standard library, which were out of scope of the linked article. I will happily migrate to C++/20 just for the <bit> header.
- bluGill 5y agoA single instruction computer is turning complete. Everything else is syntactic sugar. There are a number of things in here that will make my life easier. If nothing in here makes your life easier you probably have a trivial project that should be written in something other than C++.
- gowld 5y agoA goal of C++ is to enable library developers to create a Go and a Typescript (or an other semantic experience) inside C++, for compatibility with the rest of to C+ ecosystem.
- gpderetta 5y agoMost developers will probably not use 90% of the new additions. Of course which 10% they consider useful will vary vastly. C++ is driven on all directions by a large number of very diverse stakeholders.