Announcement

Collapse
No announcement yet.

GCC9 Lands Initial C++ Networking TS Implementation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GCC9 Lands Initial C++ Networking TS Implementation

    Phoronix: GCC9 Lands Initial C++ Networking TS Implementation

    The GCC9 compiler code as of Friday has an initial implementation of the C++ networking technical specification...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    I last wrote C++ networking code in 2005, on a Microsoft product. There were Microsoft-specific APIs for everything, but I thought that was just Microsoft doing its usual for the time and avoiding standards. I didn't realize C++ lacked some form of cross-platform networking API in the standard.

    I guess it makes sense, the POSIX folks used their own APIs and the Windows and Mac (pre OS X) folks used their own, and if you made something cross-platform you just #ifdef'd your way through it.

    Comment


    • #3
      Originally posted by Michael_S View Post
      I last wrote C++ networking code in 2005, on a Microsoft product. There were Microsoft-specific APIs for everything, but I thought that was just Microsoft doing its usual for the time and avoiding standards. I didn't realize C++ lacked some form of cross-platform networking API in the standard.

      I guess it makes sense, the POSIX folks used their own APIs and the Windows and Mac (pre OS X) folks used their own, and if you made something cross-platform you just #ifdef'd your way through it.
      POSIX and BSD Sockets are the standards, if you code to those standards your code is crossplattform. Even on Windows there are compatibility layers, unless you want to just plainly use MS Development Environments - but even there you have a compatibility layer nowadays (the functions are named eg _open instead of open, and a few other minor annoyances you can easily solve).

      what boost asio and the std networking archive is an better integration into C++, particularly when it comes to asynchronous models.

      Comment


      • #4
        why does networking need special integration into the c++ programming language , not just the standard library ?

        Comment


        • #5
          Didn't people much smarter than we are today decide that the non 100% portable stuff (i.e network sockets, dirent, etc) go into the POSIX standard and then the 100% portable stuff go into the ANSI / ISO C standard library (This is quite well documented within the K&R The C Programming Language). Why are we deciding to regress? Is this the worry that Stroustrup published a few months back?

          This is going to make it take longer for C++ compilers to support new platforms making early adoption take longer with C++.

          A network library does not belong in part of a programming languages standard library. This kind of "batteries included" approach taken by things like Java, C# and Javascript are sloppy. Also one of the reasons why Microsoft decided to drop .NET Framework a week back. It does not scale well.

          Luckily C remains undamaged through all of this

          (If you are careful with Microsoft Winsock you can avoid almost 90% of ifdefs due to the fact that Winsock is based on an older BSD sockets / POSIX spec and is actually very similar. This is also the case with non-blocking sockets / fd utilities such as poll() and select(). This is what the POSIX standard was for. Having it inside the standard library is pointless and incorrect).
          Last edited by kpedersen; 13 October 2018, 01:36 PM.

          Comment


          • #6
            Originally posted by kpedersen View Post
            For the record, didn't people much smarter than we are today decide that the non 100% portable stuff (i.e network sockets, dirent, etc) go into the POSIX standard and then the 100% portable stuff go into the ANSI / ISO C standard library. Why are we deciding to regress? Is this the worry that Stroustrup published a few months back?

            This is going to make it take longer for C++ compilers to support new platforms making early adoption take longer with C++.

            A network library does not belong in part of a programming languages standard library. This kind of "batteries included" approach taken by things like Java, C# and Javascript are sloppy. Also one of the reasons why Microsoft decided to drop .NET Framework a week back. It does not scale well.

            Luckily C remains undamaged through all of this
            There is very carefull consideration on what is going into the C++ standard library, and practically this takes a long time. What you dont want is some eager ideas from a single person/company to end up in the base language (as with Java, Dotnet).
            the network library has alot proven "prior art", and will likely live as extension before being fully merged into the standard.

            As of why this is a good thing: C++ RAII is alot less bugprone that to manually have to clean up handles. compare listing files in a directory the C++ way with your approach of using dirent directly
            Code:
            for(auto path : std::filesystem::directory_iterator("/tmp/hugo"))
            {
               ...
            }

            Comment


            • #7
              Originally posted by discordian View Post
              POSIX and BSD Sockets are the standards, if you code to those standards your code is crossplattform. Even on Windows there are compatibility layers
              I was working on a third party product built using Windows CE... 3? 4? I don't think the code shared much or maybe anything with the Windows 95+ and Windows NT+ source.

              Comment


              • #8
                Originally posted by Michael_S View Post

                I was working on a third party product built using Windows CE... 3? 4? I don't think the code shared much or maybe anything with the Windows 95+ and Windows NT+ source.
                And there are embedded plattforms where you dont have 'printf' or 'system' calls available. Does this make the C library less of a standard, or the mentioned system non-standard?

                Comment


                • #9
                  Originally posted by discordian View Post
                  And there are embedded plattforms where you dont have 'printf' or 'system' calls available. Does this make the C library less of a standard, or the mentioned system non-standard?
                  Sorry, I wasn't challenging your assertion that POSIX and BSD sockets are the standards. I believe you. This is not my area of expertise. I was just saying that on the particular Windows platform I used I'm pretty sure the compatibility layers you mentioned were not available.

                  Comment


                  • #10
                    Originally posted by GunpowaderGuy View Post
                    why does networking need special integration into the c++ programming language , not just the standard library ?
                    This IS in the standard library...

                    Comment

                    Working...
                    X