5 ms·
> Given the choice C++ is way better than C, given that it allows to use higher level abstractions and replace all unsafe C heritage by library based safe const
by cbsmith 13y ago
> Given the choice C++ is way better than C, given that it allows to use higher level abstractions and replace all unsafe C heritage by library based safe constructs.
You may have noticed that C++ is not always deemed universally better than C. What language are all the top web servers implemented in?
C has library based safe constructs as well, and C++ still has all of C unsafety. You just get to exercise those bugs at a higher level of abstraction.
> Of course, the best option would be to replace them by other languages with native compilers.
I think that is anything but clear. Certainly the option of doing so has been around. You just don't see a ton of big moves that worked out well.
> However at the level these languages are used, it will only happen when OS vendors push new languages for their OS.
Most OS's actually have a pretty small API footprint (Windows being the obvious outlier). If it were really just about the language bindings, it would not be a real impediment. A language runtime can abstract out the OS (as the C runtime does).
> So there isn't any OS vendor left that would push new system programming languages for their OS.
I'm going to claim this could well be a function of Darwinian forces.
- pjmlp 13y ago> You may have noticed that C++ is not always deemed universally better than C. What language are all the top web servers implemented in? Apache and nginx => C Tomcat, Jetty => Java IIS => C++/C# > Most OS's actually have a pretty small API footprint (Windows being the obvious outlier). If it were really just about the language bindings, it would not be a real impediment. A language runtime can abstract out the OS (as the C runtime does). If developers aren't forced to use it, then they won't use it, even if made available. > I'm going to claim this could well be a function of Darwinian forces. That is my hope, after all we only need a few generations of developers and then the issue is taken care of by itself.
- cbsmith 13y ago> Apache and nginx => C > Tomcat, Jetty => Java Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? > IIS => C++/C# Yup, the one outlier no doubt owes about 0% of its success to its tech stack. In general, if you don't work at Google and want a C++ web server on anything other than Windows, you are looking at a C++ server framework that has an embedded HTTP stack (tntnet, Wt, etc.). > If developers aren't forced to use it, then they won't use it, even if made available. I know. I spend all my time watching them because if I don't they just start doing everything in assembly. > That is my hope, after all we only need a few generations of developers and then the issue is taken care of by itself. I think you missed my point. ;-)
- pjmlp 13y ago> > Apache and nginx => C > Tomcat, Jetty => Java > Okay, if you are going to throw in Tomcat & Jetty, you should also throw in the likes of lighttpd, mongrel2, etc., all of which are written in C. Pretty much all the load balancers/reverse proxies are written in C too. Hmm.... is it maybe possible that it isn't always better to use C++ instead of C? No, they were developed by open source Linux guys that only care about C in what concerns compiled languages. C++ was always badly received by the Linux community, in contrast with commercial UNIXes. > IIS => C++/C# > Yup, the one outlier no doubt owes about 0% of its success to its tech stack. In general, if you don't work at Google and want a C++ web server on anything other than Windows, you are looking at a C++ server framework that has an embedded HTTP stack (tntnet, Wt, etc.). Yes, nothing like contributing to have more insecure servers around. >> That is my hope, after all we only need a few generations of developers and then the issue is taken care of by itself. > I think you missed my point. ;-) I surely got your point, but it is not about Darwin of languages, rather of developers.
- cbsmith 13y ago> No, they were developed by open source Linux guys that only care about C in what concerns compiled languages. > C++ was always badly received by the Linux community, in contrast with commercial UNIXes. You mean like KDE, Firefox, OpenOffice, OpenCV, VLC, bitcoin... heck even gparted is a C++ app. The kernel developers obviously have a bias against C++ (and they'd argue that it is a justified bias). User space is a different land. > Yes, nothing like contributing to have more insecure servers around. ? Not sure your point here... > I surely got your point, but it is not about Darwin of languages, rather of developers. > I surely got your point, but it is not about Darwin of languages, rather of developers. My point was about Darwinian forces applied to language or developers. I was responding to your point about OS vendors not being left around. It would appear that, for whatever reason, going with something other than C or C++ for your base OS doesn't seem to result in good survival odds.
- pjmlp 13y ago>> No, they were developed by open source Linux guys that only care about C in what concerns compiled languages. > C++ was always badly received by the Linux community, in contrast with commercial UNIXes. >You mean like KDE, Firefox, OpenOffice, OpenCV, VLC, bitcoin... heck even gparted is a C++ app. >The kernel developers obviously have a bias against C++ (and they'd argue that it is a justified bias). User space is a different land. I use Linux since 1995, and was for some time a Gtkmm contributor in the early days. I know how it feels to be a C++ developer in Linux land.
- drdaeman 13y ago> C has library based safe constructs as well, and C++ still has all of C unsafety. The problem C's lacking one of most important primitives - data structures. Bugs in standard library happen pretty rarely, I guess. So, C++ users have most common data structures for free. And when I open some C-based project's code the first thing I usually expect and see is some homegrown linked list and/or map implementations (of SIGSEGV fame). I know, there are tons of libraries that offer them, but in my experience of "hey, that server crashed, could you figure out what went wrong"-type tasks, they're very rarely used.
- deleted 13y ago[deleted]
- cbsmith 13y ago> And when I open some C-based project's code the first thing I usually expect and see is some homegrown linked list and/or map implementations (of SIGSEGV fame). I know, there are tons of libraries that offer them, but in my experience of "hey, that server crashed, could you figure out what went wrong"-type tasks, they're very rarely used. Fortunately, C++ developers just always use the STL because it is considered the bastion of all that is good in collection classes: http://www.codeofhonor.com/blog/avoiding-game-crashes-related-to-linked-lists http://www.codeofhonor.com/blog/avoiding-game-crashes-relate... http://engineering.adap.tv/2012/03/29/why-we-use-c-without-using-stl-or-boost/ http://engineering.adap.tv/2012/03/29/why-we-use-c-without-u... Don't get me wrong. I love C++ and use the STL by default, but it's all too rare that I look at a decent sized C++ project and see anything different from what you'd expect if the project were written in C.