4 ms·
C folks rather reproduce badly C++ than acknowledge its Typescript like improvements over C.
by pjmlp 1y ago
C folks rather reproduce badly C++ than acknowledge its Typescript like improvements over C.
- lelanthran 1y ago> C folks rather reproduce badly C++ than acknowledge its Typescript like improvements over C This is a rather crude misrepresentation; most C programmers who need a higher level of abstraction than C reach for Java, C# or Go over C++. IOW, acknowledging that C++ has improvements over C still does not make the extra C++ footguns worth switching over. When you gloss over the additional footguns, it looks like you're taking it personally when C programmers don't want to deal with those additional footguns. After all, we don't choose languages based on which one offers the most freedom to blow your leg off, we tend to choose languages based on which ones have the most restrictions against blowing your leg off. If your only criteria is "Where can I get the most features", then sure, C++ looks good. If your criteria is "Where are the fewest footguns", then C++ is at the bottom of the list.
- pjmlp 1y agoNah, it is called life experience meeting those kind of persons since the 1990's, starting on BBS forums. My criteria is being as safe as Modula-2 and Object Pascal, as bare minimum. C++ offers the tools, whereas WG14 has made it clear they don't even bother, including turning down Dennis Ritchie proposal for fat pointers.
- lelanthran 1y ago>> looks like you're taking it personally > it is called life experience meeting those kind of persons Looks like you are confirming that you are taking it personally. I don't understand why, though. You cannot imagine a programmer that wants fewer footguns?
- pjmlp 1y agoYes, when careless programmers are responsible for critical infrastructure systems, and rather take a YOLO attitude to systems programming.
- lelanthran 1y ago> Yes, when careless programmers are responsible for critical infrastructure systems, and rather take a YOLO attitude to systems programming. Well, that's a novel take: "Opting for fewer footguns is careless". :-) It's probably not news to you that your view is, to put it kindly, very rare.
- pjmlp 1y agoIs it? Ask the governments and respective cyber security agencies. And to finish this, as I won't reply any further, "A consequence of this principle is that every occurrence of every subscript of every subscripted variable was on every occasion checked at run time against both the upper and the lower declared bounds of the array. Many years later we asked our customers whether they wished us to provide an option to switch off these checks in the interests of efficiency on production runs. Unanimously, they urged us not to--they already knew how frequently subscript errors occur on production runs where failure to detect them could be disastrous. I note with fear and horror that even in 1980 language designers and users have not learned this lesson. In any respectable branch of engineering, failure to observe such elementary precautions would have long been against the law." -- C.A.R Hoare's "The 1980 ACM Turing Award Lecture"
- lelanthran 1y agoThe problem you facing is that any argument or quote that is used to dismiss C due to safety concerns applies to C++ more than it applies to C. Like this quote here that you posted.
- pjmlp 1y agoNope, and this is really the last comment. First of all the quote there is indirectly about C with UNIX's adoption starting out of Bell Labs, C++ would only become known to the world in 1989, with the release of CFront 2.0. Second, while you certainly can code C in C++, just like one can code JavaScript in TypeScript, the tools are there on the type system for anyone that cares, tools that WG 14 has proven not to care in 50 years of history. Third, all C compilers worth using in professional scenarios are nowadays written in C++. As last point, while C++ has the heads up over C in type system improvements, it is by no means the final answer in systems programming, ideally both programming languages should be replaced by better, safer ones, which there are a few already to chose from. Unfortunely as long as LLVM and GCC are around, industry standards based on C and C++, there is little hope that those improved languages fully take over. Thus when it comes to C vs C++, in such world where else gets to replace them in all scenarios, C++ is the only answer to that duality of choice, unless one wants to keep re-inventing solutions (badly) for answers C++ is providing since 1989.
- pron 1y agoC is sometimes used where C++ can't be. Exotic microcontrollers and other niche computing elements sometimes only have a C compiler. Richer, more expressive languages may also have additional disadvantages, and people using simpler, less expressive languages may want to enjoy some useful features that exist in richer languages without taking on all of their disadvantages, too. Point being, while C++ certainly has some clear benefits over C, it doesn't universally dominate it. TS, on the other hand, is usable wherever JS is, and its disadvantages are much less pronounced.
- pjmlp 1y agoIt isn't the 1980's any longer, there isn't a chip in such scenarios other than PIC class, even AVR get to use C++.
- pron 1y ago8051s are still programmed almost entirely in C. There are C++ compilers available, but they're rarely used. Even on STM32, C is more popular. There's a perception -- and not an unsubstantiated one -- that C++'s can more easily sneak in operations that could go unnoticed. C++ has many advantages over C, but it also brings some clear disadvantages that matter more when you want to be aware of every operation. When comparing language A against language B, it's not enough to consider what A does better than B; you also have to consider what it does worse. That's why I don't think that the comparison to TS/JS is apt. Some may argue that C++ has even more advantages over C than TS has over JS, but I think it's fairly obvious that its disadvantages compared C are also bigger. For all its advantages, there are some important things that C++ does worse than C. But aside from adding a build step (which is often needed, anyway), it's hard to think of important things that TS does worse than JS.
- pjmlp 1y agoMore like Assembly, if devs are serious enough. If there is any C, it is hardly any different from using C as cheap macro Assembler, with lots of inline Assembly. Also definitely a 1980's CPU. It is more than apt, until C gets serious about having something comparable to std::array, span, string_view, non null pointers, RAII, type safe generics, strong typed enumerations, safer casts,... Among many other improvements, that WG14 will never add to C.