10

Even though TCP/UDP/IP are commonly used protocols, I do not understand why they want it to be part of the ISO C++ Standard. These have nothing to do with the core of the language. Data structures are universally required tools hence STL makes sense but these protocols are too specific IMO.

Benji Mizrahi
  • 2,154
  • 2
  • 23
  • 38
  • This question is too open-ended. You're better off taking it to the C++ mailing lists. – Joseph Mansfield Nov 25 '14 at 11:58
  • 4
    The proposal is for a library, not "the core of the language". I for one would find a standardised network library useful. – Mike Seymour Nov 25 '14 at 11:59
  • If it becomes part of the ISO C++ Standard, what's going to happen if I use that compiler on an operating system that does not have a TCP/IP stack? – Benji Mizrahi Nov 25 '14 at 12:08
  • 5
    The standardisation committee wants networking as part of the core library, specifically _because they are commonly used protocols_. They don't _need to_ have to do anything with the core of the language - they just have to be universal enough, that most developers will want a standard way of working with those concepts. Twenty years ago (or more), the same argument you are making, could be made about data structures (and fifteen years ago the same argument could be made about mutexes). Libraries evlolve. Having networking as a part of the standard is a welcome change. – utnapistim Nov 25 '14 at 12:11
  • @bmm: If there's no underlying support for networking, then you simply can't use that library; just like you can't use the threading library without underlying thread support. The compiler won't care, unless you try to include library headers that aren't supported. – Mike Seymour Nov 25 '14 at 12:12
  • @bmm: There's the soft route of "optional features" (like `std::uint8_t`), and worst case there's always the hard route of a "freestanding implementation", which can basically cherry-pick any part of C++ it likes. – Kerrek SB Nov 25 '14 at 12:13
  • @utnapistim: Mutexes, threads and data structures are all universal concepts that needs to be integrated into the language (eg. thread_local storage class specifier). There is only one way to query keys in O(1) - unordered_map. It is clear that you require them in the language. So I don't think any feature should be included just because it is commonly used. – Benji Mizrahi Nov 25 '14 at 12:32
  • @bmm: Nevertheless, enough people think it's useful enough to propose a standard, whether or not it meets your criterion of being "universally required". As I said, the proposal is for a library, not the core language. If you don't need the library, don't use it. – Mike Seymour Nov 25 '14 at 13:21
  • @bmm, mutexes were apparently not universally required before 2011, but now that they are in the standard, they became so. This is a fenomenon I've noticed before: people tend to think about most things in the standard as "required", and things not in the standard as "not required". This is very subjective (because it is influenced by what you are used to), and applies to other languages' core libraries as well. Consider what is in the .NET - or Java - core libraries (GUI, web services, data access, networking, etc); ideally, the C++ core library would be similar. – utnapistim Nov 25 '14 at 13:45
  • Why does C stays compact then? I have not seen a File System, Regex, Gui, Networking proposal for C.. Why is C++'s philosophy not the same? – Benji Mizrahi Nov 26 '14 at 12:11
  • 2
    @bmm: Because C and C++ are different things. If they were the same thing, they'd both be called "C". – Kerrek SB Nov 26 '14 at 12:23

2 Answers2

16

There has been a long-standing sentiment that the C++ library's tiny focus area is something bad that's holding the language back. Most "modern" languages come with large framework libraries which include networking, graphics and JSON. By contrast, if you want to do any of these in C++, you a) don't get anything by default, and b) are overwhelmed with a choice of third-party libraries which you are usually unable to appraise properly and select from.

This is how that side of the opinion goes.

Of course there are other people who think that that's just the way it should be. Nonetheless, standardization is hard work, and whereas languages like Java and C# and Go have large companies behind them that can put energy into developing a huge library, C++ doesn't have that kind of manpower, and most people who spend time on C++ standardization are more interested in core aspects of programming: data structures, concurrency, language evolution (concepts, ranges, modules...).

So it isn't so much that people are generally opposed to a larger library, but it's not a priority for many. But if good ideas come around, they have a good chance for being considered. And large library components like networking won't be going into the standard library anyway, but rather into a free-standing Technical Specification, which is a way to see whether the idea is useful, popular and correct. Only if a TS gets widely used and receives lots of positive feedback will there be a possible future effort to include it into the IS.

(You may have noticed similar efforts to create Technical Specifications for file systems and for graphics.)

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084
  • 4
    Imagine a kid born in 2005 who gets an iPhone7 for their 10th birthday, but knows that all the cool kids at school do C++. "Mom, I just want to draw some intersecting shapes on my HTML canvas (my multiple dispatch code is already working perfectly) -- which class do I need to instantiate for that?" (At that point mom opens a bottle of Jack and lets the kid use her XCode with Swift.) – Kerrek SB Nov 25 '14 at 12:18
10

C++ 11 includes Threading in Standard. Now programmers need not to write PThread in Linux and Windows Threads in Windows, separably. Same can happen if Networking library gets Standardized.

Pranit Kothari
  • 9,721
  • 10
  • 61
  • 137
  • 5
    I find threads equally universal. But TCP/UDP are not IMO. There are alternatives (eg. SCTP - though mainly used in 3GPP) – Benji Mizrahi Nov 25 '14 at 12:06
  • @BenjiMizrahi It's worth mentioning that standard networking library will be easly–extensible and adding multiplatform implementation for (eg.) SCTP will be easy and multiplatform by design. – Kamil Koczurek Feb 04 '17 at 21:19