4 ms·
> Everywhere else C has been being replaced a good part of the last two decades, even all major C compilers are written in C++. You keep saying this, but I'd r
by jstimpfle 7y ago
> Everywhere else C has been being replaced a good part of the last two decades, even all major C compilers are written in C++.
You keep saying this, but I'd recommend you to look at a few random "C++" files in https://github.com/gcc-mirror/ https://github.com/gcc-mirror/ for example.
For many of these projects, "moving to C++" often means to change the file extension. Or not even that, sometimes it's just changing the build setting to "Compile as C++".
There's no reason for holy wars. Fact is that regular C code is still ruling the world. Maybe not in the financial industry. Maybe it's embedded in a few C++ syntactic constructs. Maybe some people even found a way to use RAII in a way that doesn't suck in a large project. But the vast majority of the stuff that does something is still dangerous, evil, ugly C.
And now excuse me while I go watch another talk named "C++ Features to avoid" or "Taming build times in a large C++ codebase" or "Why we went back to plain C"
- pjmlp 7y agoYeah, the old USENET argument of comp.lang.c, kind of missed that. Here are my reading recommendations, https://gcc.gnu.org/wiki/gcc-in-cxx https://gcc.gnu.org/wiki/gcc-in-cxx "This page is meant to eventually help document the ongoing effort in the "gcc-in-cxx" branch to make gcc compile in C++ mode, i.e. as C++ source code. So, the goal of this branch is to facilitate switching GCC's implementation language to C++." https://devblogs.microsoft.com/cppblog/the-great-c-runtime-crt-refactoring/ https://devblogs.microsoft.com/cppblog/the-great-c-runtime-c... > "We have converted most of the CRT sources to compile as C++, enabling us to replace many ugly C idioms with simpler and more advanced C++ constructs." https://llvm.org/docs/Proposals/LLVMLibC.html https://llvm.org/docs/Proposals/LLVMLibC.html "Provide C symbols as specified by the standards, but take advantage and use C++ language facilities for the core implementation." You are excused, write a blog post afterwards.
- jstimpfle 7y agoThere is a fallacy in taking enterprises that might be done "eventually" as being already completed and ultimately proven. What you quote is not disagreeing with what I was saying at all. Quick look at the GCC link you posted: Project Status (last updated 06/2009) Phase 1 of gcc-in-cxx now complete (06/2009) gcc-in-cxx completes bootstrap as of 03/2009 Seriously. > "Provide C symbols as specified by the standards, but take advantage and use C++ language facilities for the core implementation." Sure, now let's look at the code https://github.com/llvm/llvm-project/blob/master/libc/src/ https://github.com/llvm/llvm-project/blob/master/libc/src/ Oh, it's not even a completed project. Here is stdio https://github.com/llvm/llvm-project/blob/master/libc/src/stdio https://github.com/llvm/llvm-project/blob/master/libc/src/st... stdio/ for example has just 3, mostly empty files: file.h, fwrite.cpp, fwrite.h. Last commit was 8 days ago. It's not a project to be taken as serious evidence for any argument. You need to stop selling things that might never exist, or have long been dead in the water. Apart from that, I've looked at 10 files and the only use of C++ I've seen was some namespacing (that just makes the code more verbose IMO; YMMV). It's essentially C, the thing you're leading a religious war against. In this day and age where it's common knowledge that we're all living in opinion reinforcement filter bubbles, it should be possible to expect from people to at least quickly skim the citations they provide.
- pjmlp 7y agoAh so we are back into the comp.lang.c days. Reply will come in due time.
- jstimpfle 7y agoJust back in times where we try at least not to back up claims with citations that can't withstand a 1-minute check.
- deleted 7y ago[deleted]
- jstimpfle 7y agoGoing over that LLVM-libc website again, this is absolutely hilarious. It reads like a bucket list of grandiose features, done by a Junior developer with lots of motivation, but with no idea that these add costs and complications, and no idea what's really important. The Git repo matches that impression. There are neatly arranged directories containing CMakeLists and fuzzing stuff and READMEs and what not. Is there a good reason why strcpy() needs to be fuzzed? Some directories contain a lot of header files with 20 lines of comment junk and namespace junk, surrounding a single line that contains a function signature. And looking at the code, it seems not even 1% of the actual functionality is implemented. I will be extremely surprised if this project gets ever completed.
- pjmlp 7y agoSometimes I do make the failure of doing a hasty reply, should know better. Trying to reduce the amount of C code in the world since 1992, sometimes I win, sometimes I loose, in what concerns me, the outcome looks pretty much positive to me outside embedded development and FOSS UNIX clones. As for the whole C compilers written in C++ thread, a proper reply will follow up rest assured, even if takes a couple of weeks like last time.
- deleted 7y ago[deleted]
- tom_mellior 7y ago> For many of these projects, "moving to C++" often means to change the file extension. Or not even that, sometimes it's just changing the build setting to "Compile as C++". It's a bit more than that in the case of GCC. Not a lot more, but GCC does use templated containers. I'm not sure it uses any other C++ features, a kind of "C with templates" might have been sufficient for its purposes. But then again, what would you expect? GCC is huge. What would a huge refactoring buy the developers?
- jstimpfle 7y agoAll I've been saying is that they don't REALLY seem to have "moved to C++". FWIW
- pjmlp 7y agoMoving to C++ doesn't imply having classes everywhere, anything described in ISO C++, requiring compilation with a C++ compiler counts as moving into C++.
- jstimpfle 7y agoBut if projects are basically C compiled as C++ that's absolutely meaningless and if you take that as an indication for anything then you're just fighting a pointless religious war.
- pjmlp 7y agoOn the contrary, that has been the argument from the C side since the comp.lang.c days trying to prove a point that C is still relevant without understanding that was C++'s Trojan horse. Also just because it looks like C the semantics aren't the same, e.g. implicit conversions from void* aren't allowed in C++ compilers, ?: has a different precedence and a couple of other differences, this still in C89, let alone with everything that came afterwards.
- 7y ago