Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes: > On Thu, Mar 24, 2016 at 07:26:04AM -0400, Greg Troxel wrote: >> > If someone can convince me that C++ or even C is better suited, please >> > do so. I just fear the undefined behavior too much. >> >> I wouldn't try to convince you of that. >> >> C++ is really not suitable for portable code, because the history of C++ >> over the last 20 years is that one constantly has to worry about >> compiler version, both in terms of updating code for pickiness of >> earlier compilers, and in terms of having a new enough compiler. I've >> recently seen code written for C++11 (needs gcc 4.8) arrive at a >> fairly old but not really ancient compiler: gcc 4.1, as netbsd-5 has, >> and things did not go well :-( > > This is quite a bit FUD. Seriously, if you want to try a program for It's not FUD - it's my actual experience. If you want to target machines that have recent compilers, it works fine. My comment was about wanting to cover pretty much everything out there, including older OS versions -- basically the set of things pkgsrc works on. It may be that with some care many C++ programs have very little trouble. At this point C++ written to work under gcc 4.1 and tested under that should be ok. But the culture seems to be that developers jump on the new features becuase they work on their boxes, which makes it awkward for many others. > language version X with an implement of version Y for X > Y, what do you "Language version" is part the problem, but back in the late 90s and early 00s I found that a big program we had in C++ had to be adjusted in non-trivial ways for each new compiler version. Now I keep running into problems (perhaps like boost-libs not building on netbsd-6) where one needs a very recent compiler. > expect to happen? The situation is no different for Perl, Python, Java > or even C. It's far better in C. With most C code, only very minor fixes are needed for newer compilers, and these are almost always things that were always wrong but not caught. The fixed code then still works on older compilers. Java and python I agree with you, but those are hardly paragons of compatibiltiy virtue. They are both examples of a language process where there is no language standard and the authors of the sole/dominant implementation think it's ok to change the language every major release, and users have to juggle which programs run on which versions. perl5, as a language, has been much better. We basically can just update perl5 to the new version and almost everything works, except for a few nits to fix. And the perl people seem to get it that perl6 is a new language from perl5. > GCC 4.1 *is* ancient. It's more than 10 years old at this > point. Yes, but there are actual enviroments that still use it. And given the LTS mentality, it's not so old that I can say (in a work context) "Your world is lame because your compiler is old so you lose." Whereas if someone were using gcc 2.5.8, someone else would already have told them this. (Of course pkgsrc is not work, but still.) > C++11 code requiring GCC 4.8 is not true. Depending on the > specific library feature set, you will either need at least GCC 4.7 for > the majority of interesting things or GCC 5.1. OK - but my point holds that you need something very recent. However, given that you can build modern gcc or clang in many places, this isn't such a big deal for pkgsrc. (It is for other environemnts, where "change your compiler to accomodate my code" is not ok.)
Attachment:
signature.asc
Description: PGP signature