| General > General Technical Chat |
| How many people code in C these days, and if so, why? |
| << < (3/99) > >> |
| IanB:
--- Quote from: Karel on May 03, 2020, 04:06:25 pm ---I find C++ a horrible language, so I use plain C most of the time. --- End quote --- --- Quote ---Fortunately you can write pure C code in .cpp files and it will compile fine (most of the time!). --- End quote --- These two statements are in contradiction to each other. If your source file has a .cpp extension you are invoking the C++ compiler and complying with the C++ language standards. So we can put you in the group of people who use C++, even if you are restricting yourself to a subset of the language. |
| coppice:
--- Quote from: IanB on May 03, 2020, 04:54:21 pm --- --- Quote from: Karel on May 03, 2020, 04:06:25 pm ---I find C++ a horrible language, so I use plain C most of the time. --- End quote --- --- Quote ---Fortunately you can write pure C code in .cpp files and it will compile fine (most of the time!). --- End quote --- These two statements are in contradiction to each other. If your source file has a .cpp extension you are invoking the C++ compiler and complying with the C++ language standards. So we can put you in the group of people who use C++, even if you are restricting yourself to a subset of the language. --- End quote --- If that's the kind of logic you use, you could have a great career as a religious apologist. |
| Karel:
--- Quote from: IanB on May 03, 2020, 04:54:21 pm --- --- Quote from: Karel on May 03, 2020, 04:06:25 pm ---I find C++ a horrible language, so I use plain C most of the time. --- End quote --- --- Quote ---Fortunately you can write pure C code in .cpp files and it will compile fine (most of the time!). --- End quote --- These two statements are in contradiction to each other. If your source file has a .cpp extension you are invoking the C++ compiler and complying with the C++ language standards. So we can put you in the group of people who use C++, even if you are restricting yourself to a subset of the language. --- End quote --- Formally you are correct, I use both C and C++. |
| IanB:
I sense (as I expected) that C is used for embedded work on low level hardware. However, C++ offers a vast toolkit of features to choose from, and you are not obligated to use them all. You can restrict yourself to a small subset and still have a more comfortable time while writing compact, efficient and transparent code. Anyway, I got my answer. Many people are writing in C these days, and [in this forum] it is [mainly, it seems] for embedded applications. |
| bd139:
I still write stuff in C. In fact I'm just working through fixing 20 years of pain in a 95KLOC C program. Why do I still use it: 1. Knowledge is retained and valuable for 30 years now. That was a good investment as it allows you to get really good at the language. 2. The toolchains available are mature, light weight and reliable. 3. Relative simplicity allows compilers to make excellent optimisations. 4. It's small enough to fit in your head. 5. It works the same on everything from embedded to desktop applications. 6. It's low enough level to be used for system programming and with abstractions high enough to build high level applications with. 7. It's damn fast. 8. It allows you to decide where your performance tradeoffs are made. 9. Intent can be clearly expressed. The above program discussed has been rewritten twice so far. One talented individual rewrote it in C++ using templates and boost. It never worked and was too difficult to extend. It was also 20% slower. Someone came along and thought hey lets do it in C#. Nope! Better than C++ but still too slow (70% slower creating objects galore) and eats 400Gb (yes 400Gb) of memory. I'm sure someone will come along and suggest Rust soon and blow a lot of money unsuccessfully rewriting it again. For now I'll look objectively at each problem and invest in that 30 year knowledge in that 20 year old codebase. Which is older than Rust, older than C# and older than a version of C++ that even begins to make sense. For ref this is a high level matching engine, not a system program and not embedded. It reads a DSL and reference data from disk into memory and then streams about 100 megabits of traffic in peak (per process), matches, tags and routes it. It has had uptimes of over three years for a single process historically speaking. The only problems are is it's an unsafe language, which is solved mostly using your brain a bit longer, then Valgrind and Coverity... Edit: I will not this is not my day job. I'm doing this because it's fun and accidentally getting paid for it on the side. My day job is running entirely the opposite of this and dealing with the several order of magnitude more pain. |
| Navigation |
| Message Index |
| Next page |
| Previous page |