I came here for a C++ talk, and left with a life lesson that I'll never forget.
@dougfraser21315 жыл бұрын
I think the biggest problem with C++, from my experience over the last 15 years, is having been crushed by two or three truly horrible C++ implementations that nearly killed projects. The three that crushed me were all headed by C++ zealots that created 'platforms' instead of 'solutions'. It made my life hell, and convinced me that I never wanted to be dragged into C++ again. It wasn't the language itself, it was the people, and how they chose to use the language, and how they chose to show everyone how smart they were by using every possible feature of the language to its largest extent possible. It was awful. I have seen good C++ and I have seen bad ANSI C, but the worst ANSI C I have encountered was easier to fix than the worst C++ I have encountered, by an order of magnitude. So the problem wasn't technical, it was human. But the tool basically enabled that bad behavior. BTW: Dan Saks is awesome. He really is.
@ABaumstumpf5 жыл бұрын
That is a problem with the people writing the code, not the language. I have seen a lot of horrible Fortran, Algo, B and C code (and some other) - the "best" was imo a student-project at my university............... a web-based service for searching and rating hotels. The userfront was in html, created by a c++backend, that communicated MySql DB and used a java-process for datamanipulation. everything in the c++ domain was cast into some horrible c-style structs with void* and unions. I have seen lectures about program-design that made the simplest digital watch into a 15 class behemoth - just a watch, no stopwatch or moon-cycles or anything else, just counting the seconds, minutes and hours. On the other hand i have seen some nice C++code for embedded Systems were the complexity of setting up all the bells and whistles was neatly hidden under some classes that neatly improved the performance of the old C Code it was replacing as the compiler was a lot better at noticing what needed to be done to the bits than the old programmers with their bithacking trickery. It is neat if you know how you can theoretically swap the content of 2 variables without a temporary - but with a normal tmp the compiler sees that it is only used for swapping and will just use an extra register which is a lot faster than an extra memory access.
@VictorRodriguez-zp2do4 жыл бұрын
I simply love how simple C is, it simply makes sense. I have seen so many horrible C++ github projects with tons of classes when you could do the same in less lines of code with a single class or a struct. I have also seen great C++ projects which amaze me. They are things I wouldn't be capable of do myself. But the projects far outnumber the good ones. I simply prefer the C way, the syntax is better in my opinion. EDIT: I still use python and other languages for things that require string manipulation and hash tables though
@Artaxerxes.3 жыл бұрын
Wow I've always thought something similar too.I think its a bad idea to use every single feature in C++. Its tempting sure, but more often than not, theres always a simpler way to do it using just C. Hearing the same from an experienced dev is reassuring
@jmdavison623 жыл бұрын
Stroustrup's comment, "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off," is as true as ever. I've seen projects hamstrung by a pet idea whose consequences weren't entirely understood by its author. Sometimes the author lacks adequate understanding of the language feature, or object model feature, on which the idea depends. Motivation to learn on the job, whether it be for resume padding or to satisfy curiosity, is hard to resist, particularly if you don't expect to be around when the technical debt comes due. A concrete example of this is given at 1h22m04s, when a participant mentions misuse of smart pointers, which led to the rejection of C++ in that case. (I've seen misuse of smart pointers in C++ projects as well, for the same reasons, and with similar consequences.) Even the language contains ill-considered features, such as throw(), that were ill-considered and were eventually deprecated (C++17) and removed (C++20). That C is relatively simple and static, and thus less susceptible to unintended consequences, makes it an attractive to the risk-averse.
@toby99992 жыл бұрын
@@jmdavison62 A scalpel can do a lot of damage but If I require surgery, I don't want the surgeon using a blunt bread and butter knife. Never understould the mindset of protecting the programmer from the language.
@LemonChieff5 жыл бұрын
The argument that convinced me when I was talking to a friend wasn't "it's c with classes" but "it's c with strings" and if you've been dealing with strings in C you know how much of a pain it is. Yeah… That's what got me here. strings.
@miguel0n3385 жыл бұрын
This is a really interesting point. I'm a C guy. I have tons of experience in OOP, and understand concepts like encapsulation and inheritance and what have you, I've seen it in practice, I've done it a lot in languages like C# and PHP, but I prefer procedural programming. I like to let data be data and actions be actions, and never to force them together. The more I've learned C, the more I've realized that's why I love it. But even so, strings were a big draw for me too... and "vectors" (dynamic arrays! Wait, no malloc & free?!)... and lists... and those other things like associative arrays in PHP or dictionaries in Python (key-value pairs, kind of like structs)... if it represented DATA, I was interested. And though my preference is still C (for totally unrelated reasons), I absolutely love how C++ makes it possible to have data types that work more like other languages.
@aiman_yt5 жыл бұрын
@@miguel0n338 They are called hashtables and it should be a shame C does not even have generic dynamic arrays. Hashtables are incredibly useful and must be in every self respecting language. C is ancient and not enjoyable. But I'm still writing C, to write a compiler for a diferent language. Lol
@VictorRodriguez-zp2do4 жыл бұрын
@@miguel0n338 Don't C++ dynamic arrays also allocate memory on the heap? Also while using C I learnt that you don't need dynamic arrays nearly as much as you think. There are of course still necessary in tons of situations but I don't find it as painful to allocate && free memory on those cases. I haven't been using C for long so maybe that's why.
@cynicist81143 жыл бұрын
@@VictorRodriguez-zp2do Yes they do, but you don't need to manually handle the memory yourself. It is automatically freed when leaving scope.
@lightspeedlife82992 жыл бұрын
@@cynicist8114 Managing memory is tricky, but that's just another way of saying that it's best done *right*. You can leave solving the problem up to the language implementation, but that doesn't mean that the problem goes away. In fact, the language may introduce additional problems that are harder to solve than managing memory was. C++ is complex, for example. I find that it is very flexible in allowing the user to choose how to solve a problem, but it unfortunately obfuscates the tools to implement those solutions under a very unintuitive and non-orthogonal interface -- "barnacles", as Bjarne Stroustroup puts it. C's interface to memory management is a dumpster fire, and the only thing it does right is be small and understandable, as was mentioned in the talk, but that's not enough. Ultimately, the onus of memory management comes down to the designer of the program. It's an architectural problem, to be solved in one's own understanding of the data the system needs to do its job, and where it's going to come from. The code used to implement the system is just an accessory. C and C++ both get this right, but it's no wonder they're hated for so many for exactly the same thing. Memory management could not look uglier, yet it's their greatest feature compared to other languages.
@razzlfraz5 жыл бұрын
For anyone who wants to know the difference between polystate and monostate (bundled monostate and unbundled monostate), the difference is in the Monostate Pattern private variables within the struct are `static`. Polystate is a normal struct, ie without static private variables. The difference between bundled and unbundled is a bundled monostate is a nested struct, a registers struct. The nested registers struct is static itself, instead of every variable within it static. An unbundled monostate is where there is no nesting and every private variable is static.
@richardokeefe74102 жыл бұрын
From a Smalltalk perspective, Monostate and Singleton are exactly the same thing.
@tljstewart3 жыл бұрын
Came for C/C++ and got a phenomenal Toastmaster Course, loaded with wisdom and worth every moment.
@none_of_your_business Жыл бұрын
pretty much, it's these older guys that try to sneak a bit of wisdom along with the tech stuff
@johnhabib2895 жыл бұрын
As a preferred C programmer (and other old stuff like Perl/bash/etc) you got me when you said "coming from a culture dominated by EEs". At my first job, they had a preference for EE's over CS/Math majors most of the time because they had a large C base and worked with very primitive goals (software modems, voip, DSPs, embedded hardware etc) that the "higher language" people had trouble coping with.
@kenneth_romero Жыл бұрын
i know this comment is 3 year old, but i can't seem to find what EE means. could you expand on it? never mind it means electrical engineer.
@Dazza_Doo5 ай бұрын
@@kenneth_romero EE means Electrical Engineering. A 4 - 6 degree in applied Electrodynamics. If I had a few more Intelligence Points I could of been one.
@Mephistel8 жыл бұрын
I didn't expect a talk nearly this interesting. Thank you, Dan.
@vittorioromeo18 жыл бұрын
I loved this keynote. "If you're arguing, you're losing"...
@g.srinivasraosrinivasrao70438 жыл бұрын
no cu bk MO vy
@daggawagga8 жыл бұрын
It's funny how I've come to always expect seeing you during the question sessions at the very interesting presentations lol
@oisyn8 жыл бұрын
I totally disagree, because... ah damnit I lost.
@Leyvin8 жыл бұрын
It is wrong mind... the whole "If you're arguing, you're losing" concept. He says it multiple times because it's the technique used to make information sink in, thus it's something you'll believe without evidence. Still when you enter into an Argument, it's better to keep in mind that "You will not convince the individual(s) you're arguing against but the Observers of said Argument." The reason for this is simple, when you're engaged in a conversation you're too close to properly see the entire Frame of the Discussion taking place as such you're realistically focused on a very narrow (and often self-interested) aspect of what is being discussed. Like viewing a large picture from a foot away. Others however are several steps back and see the precise parts that each individual in the argument are actually showcasing and thus it broadens their interpretation of the picture; assuming you've made an argument that sounds appealing to them. • C++ unfortunately is no longer strictly a superset of C and instead has branched into it's own linguistic sphere. This ends up a problem because this means that today you're EITHER working in C or C++ and this is how it is often framed as well. Yet, people see the value in something the more they SEE and EXPERIENCE the benefits as opposed to merely HEARING and READING about them. It's about the practicality of the situation, where if you want your team to switch over to C++... well use a C/C++ Language (like MSVC, which supports C > C++ > C.99), instead of teaching them or telling them why C++ is better. Rather what they'll see while working with the C++ programmer is how they approach a problem, they'll see the applicable benefits from their approaches and become curious. You've switched them from a Defensive Position to a position where now they actively seek Information and believe the idea to switch is their own (which technically speaking it was; but it wasn't without said external influence in that direction) The only other option is essentially brow-beating until information is unquestionable or you push good people out of teams due to incompatibility. While none of this is rocket science (as it were), it isn't immediately intuitive.
@kwanarchive8 жыл бұрын
Disagreement is not the same as arguing.
@MyGroo5 жыл бұрын
The table metrics at 16:00 is slightly confusing at first sight, it took me a while to understand that "1.95 x fastest" is actually slowest.
@id158079365 жыл бұрын
Yeah that's quite confusing
@YoloMonstaaa3 жыл бұрын
Simply putting the measured times would've been simpler but his approach hides unnecessary units and fractions by just showing a relative difference instead.
@origamibulldoser16188 жыл бұрын
What a strange talk. I'm enjoying this.
@intvnut2 жыл бұрын
I LOL'd at the line "You're coming from a culture dominated by double-Es and computer engineers whose instructor wasn't interested in teaching them programming. They gave them a copy of K&R and said 'Make those lights blink.'" Those who know me know I've complained about "double-Es who think they can program." I've seen some amazing spaghetti code and some of the word software engineering practices ever from folks who have one or more EE degrees and are able to make a C compiler produce an executable once they've swatted down enough warnings and errors. Put down the pitchforks. _My own degree is BSEE._ I have no formal training in computer science. My criticism comes from _within_ the EE discipline. :-) I was very fortunate to have a very forward thinking and rigorous professor that taught me C back in 1993, during my freshman year. He didn't just shove K&R in our hands and say "make those lights blink." He shoved K&R in our hands and taught us how to program. Or at least tried. (Yes, K&R 2nd Ed was actually the textbook for that class.) I don't know how well it took, though. From what I remember of the grade distribution, three of us were at the top (and I was in the three) and the rest of the grading curve was way below. At the time I took the course, I knew a half dozen BASIC dialects, assembly languages for three different architectures (TMS9900, 6502, 8086), and Pascal. He switched to teaching C++ as the default within a year or two. Even before that he strongly encouraged me to take a look. But, like Dan's comment just before that like said, you really do need a mentor to figure out how to use C++ properly. It wouldn't be until years later I was mature enough to seek out the advice I needed (through online resources, books, and so on) to properly switch gears. I did it in three phases. Around 2006, I started using C++ in earnest as "Better C," with limited use of classes for interfaces, heavy use of inline and namespaces, and heavy reliance on compile time type checking. Around 2008 or 2009, I started replacing macros with templates to get compile time evaluation. By 2010, I managed to put together some super-efficient code that (for many aspects, at least) compiler proved correct at compile time. The most notable of those C++ projects were actually embedded projects that needed to run in extremely constrained environments. (Think "RTL simulation of a CPU that doesn't exist yet, running around 1kHz.") I wasn't constrained by memory capacity; rather, I was constrained by extremely low execution speed, including startup overhead. In 2013, I was handed a project that needed rescuing. It was a 17 year old C++ codebase that had basically rotted from within. I decided to greenfield it in modern C++. I decided to "go native," and immersed myself in as much online training as I could. I had seen enough to know that I needed to truly open my mind to learn it properly. BTW, I also laughed extremely knowingly at the whole discussion on the confusion between arrays and pointers in C. ZOMG some of what you had to say could have been lifted directly from answers I wrote on Quora or private discussion I had there. And I know it wasn't, because this talk was in 2016, and I wrote those answers later. I wish I'd seen this talk sooner. I would have linked to it so many times! I don't know how I missed this talk back in 2016. I'll pin it on changing jobs in 2015 and being sucked back into an almost exclusively C environment. That kinda dampened my enthusiasm for watching CppCon videos. Turns out, I really missed out on some good material.
@BradenBest3 жыл бұрын
41:06 okay you're right that we happily accept weak typing (because weak typing is flexible typing), but you're wrong about the mindset. A competent C programmer will do their due diligence in learning about undefined behavior, and taking care to read documentation so that they can properly use the functions and APIs provided. I've been writing C for almost a decade and my debugging sessions are short and far between because I know the pitfalls. I write unit tests and write my code in an agile, modular, data-oriented fashion. I compile with debug flags and strict warnings and sanity check my runtime against valgrind. The payoff is that I actually _don't_ spend a bunch of time debugging or hammering at code until it "manages to compile". I get it right the first time, and when there's warnings or errors, I read and address them before testing the program.
@BradenBest3 жыл бұрын
I would also appreciate if someone would stop censoring me. Somebody's deleting my comments and that's creating a very one-sided discussion. I'm not here to fight.
@mikicerise62503 жыл бұрын
@@BradenBest That's KZbin's censorship algorithm. You've probably been flagged by it for unrelated comments and now it's punishing you.
@RetroDawn8 ай бұрын
@@BradenBest Were you having a discussion in replies to your parent comment to this one?
@NXTangl4 жыл бұрын
The biggest problem with selling C++ to the embedded world is possibly that many of them are thinking in assembly but enjoy not having to write register management code themselves. In this case, they may be thinking more about "I know roughly what this code will do in assembly" than "I want to abstract over the lower-level algorithms [thus making them invisible] and give the compiler freedom to optimize them [thus giving up control]." Also, in the case of (e.g.) the airline industry, debug mode is probably going to be on in production because changing the binary requires redoing the cert process.
@calebmoore15824 жыл бұрын
That was pretty deep and introspective. I would add that a major issue is that particularly during the late 90s and 00s, C++ was inextricably linked to deep, unnecessary inheritance hierarchies, pointer spaghetti, hidden side effects, data structures based around a conceptual metaphor rather than actual usage, and the various other things that were considered “better” according to the prevailing understanding of Object Oriented Programming at the time. Over time these have become generally accepted as being almost as bad as not attempting to structure code at all. Sure, there was nothing in the language that forced people to write code in that way (and indeed C++98 was remarkably unsuitable for such things) but still, it’s fair to say that most of the people most vocally pushing C++ at the time probably had something resembling that in mind. It’s important to clearly express what one isn’t advocating, lest a straw man be built around you in other’s understanding.
@RetroDawn8 ай бұрын
Even worse than that was using C++ in the early to mid 90s. That turned me off from C++ and back to C until after Java 1.0 was released in Jan 96. People who don't understand why Java took off should learn the landscape of software dev and OSes and the Web in the mid-90s.
@anthonyrocha80757 жыл бұрын
I have used C++ in a embedded domain only once in my entire 25-year career. Interestingly enough it was in the beginning of my career, back in 1994 in my native Brazil. The project was a bedside vital parameter monitor , the DX2010. Not only the GUI was written using C++ (it used the Zinc Applications Framework), but also the acquisition modules, based in the Intel 80186 micro-controller were written in C++.
@anthonyrocha80757 жыл бұрын
I am looking at C++ again. The C++ 14 standard seems to address most of the concerns and there are many more guidelines on how to avoid unnecessary complexity.
@briansonof4 жыл бұрын
Nice talk. I think it's especially important to emphasize as he did that C++ is based on C and you can convert slowly into idiomatic C++ without ever being forced into it. At one job I happily implemented C bindings for C++ library functions because I wanted them to be used in many existing C programs without actually forcing them to be rewritten gratuitously. C++ does not have to be some monstrous thing and it's totally fine to use C libraries.
@edwardyang82545 жыл бұрын
My experience is kind of the opposite. Many programmers are using C++ only because the job requires, but they are still writing C.
@MCLooyverse4 жыл бұрын
I'm a mostly self-taught C++ programmer, and I also have, I think, a C-style way of doing some things. Once I learned what new and delete were, I quit using malloc, but I still use C-style arrays way more than standard containers, just because often they're easier, and more fun.
@RetroDawn8 ай бұрын
@@MCLooyverse Wait until you learn RAII and smart pointers and stop using new and delete. Or, since it's been 3yrs, you likely already have. ;)
@MatthewChaplain8 жыл бұрын
I just found myself cancelling rather than posting a comment on our internal bug tracker while muttering to myself, "If you're arguing, you're losing." Mr. Saks would be proud.
@henrikoldcorn3 ай бұрын
@@MatthewChaplain I decided years ago not to have arguments on the internet. Sometimes I fail, but it helps - life is less frustrating and just as or more productive.
@Bolpat2 жыл бұрын
If I remember correctly, as a response to making players addicted, in _World of Warcraft_ they once introduced a malus for playing for multiple hours in one session. Players hated it. Then, they went to a reward system, where if you did not play for some hours, your character is “refreshed” and “ready to take on challenges” which is expressed in a stats boost.
@brymusic15424 жыл бұрын
I started programming in C in the early 80's. When the first commercial C++ compilers came out in the late 80's I was instantly hooked. I saw the potential for far fewer bugs but still having the speed. I learned on my own how to map a C++ class into C which meant there was no mystery to the new fangled world of C++. I've never understood why anyone would choose C over C++.
@richardokeefe74102 жыл бұрын
Because of truly horrible experiences with C++ compilers. (I still remember one project, fortunately not mine, where the companies involved had such bad experiences with C++ that they agreed to develop a new OO language of their own.) Because my old C code still compiles (with appropriate flags) but none of my old C++ code still compile. Because of an industrial project run by a famous person in the OO world that after several years of work and a truckload of money FAILED, whereas a much smaller team using a non-OO language succeeded in less than a year.
@rationalcoder8 жыл бұрын
Incredible talk!. I watched the whole thing. I would be completely on board with replacing C with C++ if it weren't for: 1. C is our only standard ABI. We need standard exception handling and a standard ABI, even if the compiler we are using supports compiling to a custom ABI for particular use cases 2. C compilers are much easier to implement than C++ ones, so they can be made available for a platform more easily. I guess this could be remedied by encouraging the use of clang++ as a front-end 3. C++ code compiles to a considerably bigger binary than C code, due to static initialization in the implementation of the object model. We need compiler options to generate small, light-weight binaries. On a different note, I also agree that modern c++ doesn't mandate the use of streams, vectors, and strings. We need to make it obvious that you can write minimal, basic ZCAs in C++ and still be writing good C++; that is, if you can't get the performance you want the things you find in the standard library, feel free to use C-style code that is necessary to get the job done.
@MatthewChaplain8 жыл бұрын
3 is, at least, solveable. One of the previous C++ conferences had a video on just that subject. The bigger binary is largely due to the inclusion of iostreams in the binary. This can be removed.
@rationalcoder8 жыл бұрын
Matthew Chaplain Glad to hear it!
@peppybocan8 жыл бұрын
Agree, I'd *LOVE* to have an ABI across the platforms. Therefore it's okay to write in C, still.
@dkierans2 жыл бұрын
Super nice talk. Yes. This is one of the few that you save and need to watch it again.
@Bolpat2 жыл бұрын
1:17:00 C++ is more complex necessarily because its features are (almost) a superset of C’s features. However, as a C programmer, you already know most of the basics so that you’re in the “roam freely” domain of learning. You learn what interests you or serves your needs. You don’t need to know about the other stuff.
@ABaumstumpf2 жыл бұрын
" You don’t need to know about the other stuff." You can do that with C++, just that there you have easier tools available and are less restricted.
@a_commenter2 жыл бұрын
As someone who generally prefers C to C++, this talk really got me thinking about why that is. Part of it is just personal preference, but I think a significant part of it comes down to that although C++ enables you to write better code, it also enables you to write worse code, and we come back to the tendency to feel the losses more than the gains.
@FlanPoirot Жыл бұрын
I've used C, C++ and Rust. I still enjoy and use C and Rust extensibly. But C++ is something I use very sparringly. My issue with the language is not really the losses vs gains, but how the language just keeps getting bigger, there's an aversion to deprecation and stuff keeps being slapped on top of it and the STL is a mess, unless you're a template ninja understanding it takes a lot of mental effort. That being said sometimes I'm writing something and the best library for it is in C++ or there will be too many allocations and stuff and I just want to use some C libraries and have C++ manage the memory for me.
@mareknovak22457 жыл бұрын
I was looking in hurry for something on KZbin, then I found this video by coincidence and I just could not stop watching it! Really good talk!
@pmcgee0035 жыл бұрын
Excellent pop-up psychology lesson at cppcon !
@RetroDawn8 ай бұрын
I would love to see what the trendlines are since then. I would be willing to bet it's gone up for C++
@adityamishra8497 Жыл бұрын
I have been working as an embedded software dev for 2 years. The reason I use c is because everyone else is using it. Legacy code is written in c. All the libraries are in C. And I had an argument with a c++ programmer about use of c++ in embedded and the reasoning he gave me was classes and all. Oops is great but I personally don't think it is that big of a deal as people make it to be and certainly not big enough to give up all the libraries and old code out there. About the error message at compile time I totally agree I still mess up things specially strings.
@ilanyounanian42782 жыл бұрын
As an EE I would be interested in modern C++ solutions applicable to the embedded domain. Are resources available (preferably implementing HW access and RTOS abstraction)? I think, the embedded C programmer's expectations are: tailored and proven solutions... Patterns. Does and don'ts. My concerns: Portability of Cpp in embedded. Welcomes: Built-in constructs for generalization and specialization on Structure + Behaviour while preserving type information and type checking.
@tissuepaper99622 жыл бұрын
Look at the paper by Bjarne Stroustrup called "Software Development for Infrastructure". You can find the PDF on his website. It's a little old but maybe a good place to start.
@btowntkd7 жыл бұрын
What a great talk. The questions at the end fell apart a little bit, but I was surprised that the final question - off-topic as it was - turned out to be so informative. The "embedded course in a box" which Dan brought up looks incredibly useful (albeit expensive).
@thirtycrows4 жыл бұрын
1) Hiding details is not primarily a concern of debugging but of certification. When certifying your code for medical or aviation you often have to trace the written code to the assembly. This is magnitudes more difficult in c++. 2) When writing bare metal code for a small microcontroller the amount of assembly and startup code and the resulting startup code size needed to initiate a working c environment is a fraction of getting a c++ environment up and running.
@ChrisM5412 жыл бұрын
Exactly. The vast majority of C++ programmers have an extremely poor understanding of the core of the debugger - assembly language.
@mikolajmikolaj11549 ай бұрын
Could you point me to which regulations for medical devices require you to trace code to the assembly? I am not aware of that in medical nor automotive. Perhaps I misunderstood what you meant by "trace the written code". I am somewhat familiar with EU and USA regulations for different safety classes and I can't think of anything that matches. Code coverage kind of springs to mind but still II can't see how that would be different between C and C++. The comment is 3 years old but I still hope someone can shed some light on the matter here. Thanks.
@guy15248 жыл бұрын
The reason I moved from java to C++ was the massive amount of feature I wanted badly in C++, but not in java.
@keris39204 жыл бұрын
I also moved from Java to C++, but because I was tired of things like JRE. It added a level of abstraction that made it difficult for me to peek at the hardware. I found myself wishing I was modifying the JRE, not the bytecode itself. C was out of the question for me coming from an OO language like Java, but C++ made a lot of sense.
@gtdcoder4 жыл бұрын
The best way to make C programmers “see the light” is to develop something in C++ that is very widely used or very popular. Recently Jason Turner ported the Doom source code from C to C++ and the resulting binary was not only faster but also smaller. Imagine if someone developed an OS that is as good as Linux or Windows completely in C++. Or if some device driver developer starts beating all competitors by shipping C++ code that is not only faster to develop, but also more performant and safer. Odin Holmes as shown that this is possible.
@G33KN3rd4 жыл бұрын
that brings up a few questions. You said he ported Doom's C code to C++. What C standard was the C code and what standard was the C++ code? Also, did he change any internal code architectures or did he use the same architecture and patterns as the C code version? How was it determined that it was faster and smaller? What compilers were used and what versions?
@cippo1995 Жыл бұрын
Does the computer have the concept of a class? PS: What I mean is that PCs work with binary, binary is equal to assembly, assembly are just instructions from an ISA. C encapsulate assembly in a simple way (by modern standards), making it easier to work with PCs, being pretty much as fast as it gets if well optimized. You can go beyond simple C with abstractions and yes, you can achieve the same performance (if you achieve good assembly), but stuff can go bad real soon.
@PhilfreezeCH2 жыл бұрын
The thing that annoys me the most about C++ (and why I rarely use it), is that there are seemingly ten thousand ways to do nearly the same thing. The one thing he mentioned is Vectors vs Arrays. If vectors are so much better than arrays then why do arrays even exist? Why isn‘t an array just a vector? Why do I know have to go out and try to find credible information that tells me when I should probably use one over the other? It is even worse when it comes to ‚pointer like‘ things, especially function pointers where C++ seemingly has ten different concepts to pass function and all come with slightly different restrictions that aren‘t visible in code. In C I decide and it is immediately visible through code with functions (pointers) can act on ‚objects‘ and which are common to some ‚class‘ or whatever restriction it has. So for C++ I constantly have to check the wiki or Google to find some options that are similar to what I want to do, then I have to find out which restrictions these options have and then I have to find out which one would be ‚recommended‘ for my use case. And quite often the recommended way you find is presumably aimed at writing desktop applications and the library for it instantly fills all available storage on my embedded device, making it useless. To me C just seems to be much more focused (it is meant to write really low level embedded code) while C++ tries to have a bit of everything for everyone which just ends up making the language and libraries really confusing.
@toby99992 жыл бұрын
I don't understand why having lots of options would be a reason to not use any of them. I just use the features I like or need. I've never used smart pointers. I've never used lambdas. I rarely use exceptions handling because the 30 year old code base was originally all C code and isn't set up for exceptions. I often mix C and C++ methodologies within the same code. I ignore the language lawyers. I'm a pragmatist.
@pavfrang2 жыл бұрын
People are ignoring C++ (due to misinformation) the same way that Fortran (2018) is ignored too (due to misinformation), which is also a modern language with OOP support. Let's not be very judgmental then. This was a fascinating talk.
@TomQue08 жыл бұрын
I suppose there is a reason people do not like to use C++ and if I would have to guess, I would say mainly because the code does not look nice (or can be confusing -> I am thinking of operator overloading). From personal experience I can say that I like to think of programming as an enjoyable act of making art in a sense of creating a nicely structured, understandable and effective code. I kinda feel that C++ doesn't fill this need (at least for me). There is also just too much tricky details to know before you can be "good" C++ programmer. And even then, any "standard" programmer reading the code after you will probably have some hard time. For most of the projects I suppose these reasons just outweigh the possible performance gains.
@stefanluginger36825 жыл бұрын
TomQue0 Yes. Maybe in short: do not underestimate the fact hat C++ simply looks ugly. 😬 it’s very useful and often a reasonable thing to do but it’s not easy to learn it’s features even for people with other OOP background and it’s really ugly.
@edgeeffect2 жыл бұрын
These days, I think it seems to be more like "Talking to C/C++ programmers about Rust"
@JohnCLiberte8 жыл бұрын
Absolutely brilliant talk. thank you very much! loads of insights and a lot to think about.
@KX362 жыл бұрын
I have seen so many people over the years programming embedded in C++ and thinking they're using C. No standard libraries, no heap allocation, classes are rare, instead using global variables and functions everywhere, file extensions don't really matter to the compiler, so you can call a c++ file *.c . Becomes hard to see whether it is C or C++. Some people call it C+. But you don't have to use every feature of C++ for it to be C++, just one that isn't in C. Almost always they've included a C++ class library somewhere and don't know it.
@Swedishnbkongu2 жыл бұрын
There is a difference between interpreting policy-effect data in hindsight and a medical study. You can't be sure about the level of control, cultural significance, etc. That could explain part of the "misunderstands what they don't agree with" thesis
@PetterStrandmark8 жыл бұрын
A strong argument IMO should be that sorting in C++ (with std::sort) is usually more than twice as fast as sorting in C (with qsort). Speed and efficiency should appeal to C programmers.
@PutBoy8 жыл бұрын
Is it though?
@Spiderboydk8 жыл бұрын
Yes, largely because you can easily inline your comparison function in C++, rather than having to supply a function pointer in C.
@PetterStrandmark8 жыл бұрын
Yes it is. Claus is correct, it has a lot to do with inlining and the optimizations made possible after that.
@aiman_yt6 жыл бұрын
@@noobyfromhell you can always use the c library on c++ or ditch them alltogether
@isodoublet5 жыл бұрын
>I think C++ does have a place in embedded, but you'll have to use a completely different base library, one that doesn't rely on heap allocation or exceptions. Well, you can always roll out your own custom allocators that use placement new, though getting C programmers to do this would be nearly impossible. Unfortunately I really don't see how to put this sort of thing in a library though, because the question of where the placement new should place the newly allocated objects seems to me very dependent on the target environment. I have next to zero experience with embedded though, so if I'm talking out of my ass please correct me. ", at least more so than trying to shame people into using C++ by comparing C users to Republicans" Yeah the whole framing (heh) of the conversation was quite ridiculous. I'm not sure why I should listen to someone's thoughts about persuasion when most of their core argument is a haphazard combination of pseudoscience and actively trying to piss people off.
@jameslay65053 жыл бұрын
I think the intricacies of C++ are daunting.
@figboot Жыл бұрын
Same. Whenever I try to start writing a C++ thing, I find myself spending more time browsing documentation than actually coding, and thinking "wow I could have done this using this fancy language feature" instead of actually working. Maybe I am letting perfectionism take over too much, or I am misunderstanding the language as a whole.
@Orgyilkos7 жыл бұрын
Isn't the problem for embedded systems is that they are not always shipped with c++ compilers, because c++ compilers are more robust?
@jim0_o8 жыл бұрын
58:00 I see a Data type as a set of rules for interpreting a piece of memory(of a specific size).
@JohnCLiberte8 жыл бұрын
I would define it a bit more generically without mentioning 'memory' or 'size', something like this: an information pattern that provides a uniformal interface for performing a set of operations.
@PutBoy8 жыл бұрын
It's not really a matter of what you see, that is literally what data types are. Any attempt at defining it further is just naval gazing.
@heater59794 жыл бұрын
@@PutBoy This is not true. Types are all about what you see and what operations you can perform on what you see. Even in C/C++, which are low level "close to the metal" languages. For example they have an "int" type. That "int" type says nothing about how big an item is, could be 16, 32 or even 64 bits for example. That "int" type says nothing about how an integer is represented in memory. Could be two's complement, could be sign-magnitude, or anything else. For this reason neither C or C++ specify what happens when an addition of ints overflows. Moving up a notch, in Rust the types not only define operations, they encode when you are allowed to perform those operations. Types have lifetimes. Further up Javascript has "numbers", you have no way to see how they are stored. Could be as 64 bit floating point could be 32 bit integer, as the run-time sees fit. Or what about integers in Python? Which can be of arbitrary size ?
@georganatoly66462 жыл бұрын
I much prefer C as I find it to be more 'solution focused,' in effect I've come to appreciate C's relative resistance to arbitrary increases in complexity, C++ almost encourages you to add incidental complexity in an attempt to meet some set of ideals that are often unrelated to directly implementing the solution
@cyberkotatsu8 жыл бұрын
I came here to watch a talk on C++ and I wound up watching something so much more and truly incredible.
@xamael19896 жыл бұрын
I just dont get why is cppcon all about killing C
@G33KN3rd5 жыл бұрын
because cppcon is mostly done by people who have some influence in C++'s standard as well as promoters of it.
@Bits322 жыл бұрын
Impressive talk. Also very interesting personal thoughts and ideas apart from the technical aspects.
@danielkucharski34885 жыл бұрын
this is actually interesting but for most of the he use psychology to as a proof of his vision while actually it can be used to support other vision (that he is wrong and he believes in some imagine truth). actually in safety systems like airbags controller C is used only as C (without std library) and because C is very simple to debug. Embedded world is completely different than ordinary computer world and something like this need to be emphasize. I sometimes get in touch with java or some frontend developers and this are completely different world. They do not understand C and I do not expect they ever will. Embedded world is more about assembler and understanding how everything work in systems and from that point of view C is just simply well suited to do the job. C has very simple structure and if you use some MISRA rules or something similar you never made something wrong. While using C in the end it's very simple to find any data in memory and in map file. Because everything is about some numbers put somewhere in the memory. That way we do not loose understanding of this. Only by strong work on hard embedded systems we can understand that. And I do not expect that normal computer system programmers would catch that difference.
@ABaumstumpf5 жыл бұрын
C++ can be just as easy to debug - it is your choice how complicated you make your code. Same as C can be one horrible mess that you have nearly no hope of understanding, once you dive into the dark-ends with hundreds or thousands of lines of macros only. If you think C++ is too complex in that regards then it simply means it is a language not suited for you.
@richardokeefe74102 жыл бұрын
Compared with C++, C is (a) stable, (b) supported by more different vendors, (c) much better understood, (d) much less likely to have massive unsuspected overheads slip in. There are also some really good checking tools.
@shawnshaw98592 жыл бұрын
one perspective is that many embedded coders are from EE background without a full CS training, and it's much easier to hack on C instead of the heavy study on c++ for them
@IgnoreSolutions3 жыл бұрын
I enjoy writing C more than C++, but this talk is a prime example of how fanboys will argue till their face is blue just to be right. Both languages are amazing tools and like any tool, your best results come when you understand the tool and use it in a way that is performant and sensible for the solution you’re trying to create.
@zvxcvxcz4 жыл бұрын
12:00 But why would you make that private and require accessing through the class method ... ?
@emilianosenega45644 жыл бұрын
Because that's the C++ way! Hide the data away and tell a story with your code, even in embedded systems...
@jbird44782 жыл бұрын
@@emilianosenega4564 But I don't want my code to tell a story. I want my code to write to the timer registers. C++ programmers make everything so goddamn complicated ;)
@brymusic15424 жыл бұрын
It's interesting to look back on the state of the embedded world only 4 years ago. The rise of the Arduino platform has turned it upside down, since it's main programming language is C++ (albeit with some behind the scenes preprocessing). It's important because kids are growing up with Arduino and thus are being exposed to C++ without "knowing any better".
@tomeksowinski4995 жыл бұрын
Wrong title. He's talking about C programmers to C++ programmers.
@kuhluhOG5 жыл бұрын
no, he talks to C programmers about C++ (the language)
@TheOriginalSnack7 жыл бұрын
I think C usage going up and C++ going down probably has more to do with the change in the readership of the magazine than anything else. Older people are more likely to be set in their ways, using C and subscribing to print magazines. Younger people probably use more C++, but they don't care about print magazines. As the magazine slowly dies, the old guard sticks around the longest.
@billybbob188 жыл бұрын
This makes me feel better about learning cpp as a first lang. I'm doing mostly embedded applications. The line graph shown is actually showing a shift TO CPP; a slow shift. Both languages are in flux right now, just waiting for a shift in either direction.
@matsim02 жыл бұрын
The main reason C dominates in the automotive sector is that the code generators (e.g. from Matlab/Simulink) produce C code...
@michal.gawron8 жыл бұрын
49:30 - just tell C programmers, that they're losing precious CPU time by using C, and they're less efficient that way.
@jim0_o8 жыл бұрын
That is really a compiler problem. There must be a reason why C (mostly) compiles so much faster.
@michal.gawron8 жыл бұрын
I don't think it's just the compiler problem. In C++ you can give more hints to a compiler through a type system, than you can in C. C compiler can't make as many assumptions as C++ one because of that, hence C generates usually less efficient code. The famous std::sort() which can be 2.5x faster than equivalent qsort() in C.
@jim0_o8 жыл бұрын
Michał Gawron are you sure those are equivalent sorting methods? (edit: I write my own sorts when it matters.)
@michal.gawron8 жыл бұрын
Yes, I'm sure. You aren't?
@jim0_o8 жыл бұрын
Michał Gawron nope, I haven't looked at them.
@toby99992 жыл бұрын
People pay too much attention to whether languages are becoming more or less popular. I use C++ because I prefer it and I prefer working in the problem domain that C++ is well suited to. Do people care whether hammers and screw drivers are becoming less popular? They're all tools.
@s.d.gentry13548 жыл бұрын
Excellent talk! Embedded systems is the one area where I had thought C was the superior solution. I am pleasantly surprised to see C++ performance even in this domain.
@EdwinFairchild7 жыл бұрын
The problem i see with using C++ is that every microcontroller vendor i have used provides libraries in C and not C++ classes so i would have to rewrite thousands of lines of drivers just for the sake of getting "the same" performance, if thats the case its pointless. I would switch when performances is heaps and abounds better and not "the same" as C lol
@perfectionbox3 жыл бұрын
one complaint i've heard about c++ is that "it does things behind one's back." The C coder hates constructors and destructors, and doesn't like operator overloading. Whatever the program is doing, he wants to see explicit lines of code for every action. Badically, he wants a portable assembly language, and c++ ain't it.
@ChrisM5412 жыл бұрын
A huge issue is that the vast majority of C++ programmers have an extremely poor understanding of assembly language. If you don't understand the core tool of your debugger then you're placing far, far too much blind faith in your compiler.
@rpocc2 жыл бұрын
I’m OK with constructors and destructors but I hate caring about calloc/free which I absolutely need on the memory-limited platform I’m using to implement anything interactive and dynamic. But probably using vectors could solve most of difficulties with memory allocation. The only thing that bothers me is that I can’t do much hacking with objects which I didn’t mapped and allocated on my own, knowing exact continuity, size, location, etc etc etc. I’m I kind of a crazy guy treating arrays as pointers, mapping custom structures to register files, uniting different structures and operating pointers to functions.
@rajdivecha8 жыл бұрын
@1:17 did Dan say that C++ is more complicated than C? If so then I would say it is a very wrong statement because if you try to implement some code in C that is functionally equivalent to C++ with say the purposeful use of overloaded functions then it is going to be the same amount of code but C++ in fact makes my life easy by providing me features that would otherwise require me to write code (in C). I do not see all that as complications. C++ isn't complicated at all.
@aroundyouaroundme8 жыл бұрын
Ражалпрограм Наджави ты просто тупенький, речь о том что C++ гораздо более сложный инструмент чем C, но тебе немытому этого не понять. Ты то сюды камментишь просто чтоб за умного сойти.
@MaherBaba8 жыл бұрын
"C++ isn't complicated at all." is not something anyone would say who truly knows the language.
@rajdivecha8 жыл бұрын
***** do you think that the people who claim they know C, really know the language to use it efficiently? I know good developers/designers with 25+ years experience fail C interview. However, a lesson I have learned along the years is that nothing is perfect and so aren't the people, so don't expect everyone to know everything. If someone doesn't know something and you show him how it works and he uses it effectively then it should be more than enough and the person will slowly become an expert. Anyways, on the same line C++ isn't complicated and those who have worked hard in C will find C++ as a blessing because they won't have to implement many commonly used algorithm as the same comes in the form of language feature or libraries.
@MaherBaba8 жыл бұрын
Rajendra Divecha in what world do you live where people with 25 years of C (a language that hasn't changed a lot in that time, mind you) experience fail at a C interview and C++, which gets tons of features frequently which even power users of C++ can't catch up with, is not complicated?
@JohnMarkIsaacMadison3 жыл бұрын
@@MaherBaba I am going to guess one of those world where even the interviewer doesn't know the answer to the question. I was once asked "Can you store Bitmap Data in JSON format?" I am like... I think the answer you want is "No". But the answer is "Yes , but you shouldn't." It's like the high school meap tests all over again. Dinosaurs likely evolved from ... "A: Birds , B: Lizards C..... " I think the answer you think is correct is "Lizards" but the answer is really "Birds".
@neimsaci9423 жыл бұрын
I am not a programmer, yet. And now I am deciding which language to learn. One thing I noticed about this talk is that is very good talk and very well reasoned. But what interests me is when and who defined that those people who using C should be using C++? On what that statement is based?
@mikicerise62503 жыл бұрын
Why not both? C++ is based on C. I learned C then C++. It helps enormously to understand C++ to first learn C IME.
@rajdivecha8 жыл бұрын
IMO, the problem lies in the fact that C++ is presented in an overly complicated way.
@TomaszWota8 жыл бұрын
To Rajendra - I think that applies to newbies more than to experienced C programmers. Newbies to programming will bounce off C++ hard if they'll be taught at the beginning of it as if it's C - with raw arrays, raw pointers, null-terminated strings, printf/scanf formatting codes, manual memory allocation, off-by-one errors all over the place, "voodoo" programming (slapping & or * at things to make pointers work), etc. There's a great talk about it at CppCon 2016 titled "Stop Teaching C" - which is of course about teaching C++ as if it's C. ;)
@PflanzenChirurg7 жыл бұрын
i did not really bounced off but i have to agree, it took me longt to get familliar with the strict concepts of several aspects, my first question about the most functions was "whats the main purpose for?" i had to get it by myself, and yes it makes it harder to go forward, becaus u have to build up a fundament of knowledge before u can even imagine those mainpurposes or even own ideas
@Hyperian8 жыл бұрын
you'd be so confused if you start watching this from 26:43
@DatMilu2K8 жыл бұрын
Hyperian 25:13
@schreiberstein7 жыл бұрын
Hyperian i
@JuanluMorales2 жыл бұрын
The talk should have started with 1:34:08
@leonardocaetano6307 Жыл бұрын
LMAO
@pyajudeme92455 ай бұрын
For an outsider, this is hilarious. It sounds a little like Star Wars. These are our brothers taken by the dark energy C, we can bring them back, but we have to be careful that they don't fall deeper.
@idsantos2 жыл бұрын
My understanding about programming is that programming is about choosing the right tool for the job. After all, who uses the back of a screwdriver to drive a nail into the wall. The failure of CPP in Embedded programming!! ... err What?... That does not make sence. What about the failure of diesel engines in motor sports such as Formula 1 or Nascar? What about the failure of petrol engine in container ships, freight trains, or city wide metro trains? Or "Identify factors that are inhibiting C programmers from moving to C++"!! What if we change that to something like this. Identify factors that are inhibiting the use of petrol engines in container ships? The thing about programming is to stay open minded, after all. There must be a reason we don't use the same tool for all tasks. Just as petrol engines is not used for all applications. Too me programming languages is no difference from engine types, or different types of tools. Hammers are normaly used to hammer nails, bu may sometimes be used to loosen a bolt or nut, however nobody uses a hammer to unscrew a bolt or nut.
@charlesd45727 жыл бұрын
The issue is that for smaller systems there is 1. Fewer off the shelf C++ compilers, 2. When you use C++ you have to strip it down to something approaching pure C and 3. Any benefit of C++ over C creates code bloat due to some type of automisation that should be left in the hands of the programmer not the compiler. Above all C maps more closely to the assembly than C++ when you use features like templates - that's not a good thing. Of course talks such as this one isolate things down to the most favourable cases but in the main there is no gain in moving to C++ only a lot of superfluous and redundant features. It has been tried and it just doesn't fit as well as C - there's no conspiracy! Also your approach is assumes that C++ is the right choice - again that is your perspective it doesn't make you right. I think the main issue here though, and it is clear from your talk, is that you're living in a echo chamber.
@knofi7052 Жыл бұрын
I will always prefer C over C++. I want to think about a solution of my problem and not about the language I use.
@philschatzmann52818 ай бұрын
I always prefer C++ over C for exactly the same reason!
@tomzhangg5 жыл бұрын
Would using C as a method of generating dna sequences for drug discovery based on very specific criteria be considered embedded software?
@Silmarieni18 жыл бұрын
While I agree in theory that C++ has a lot to bring to the embedded world, it is not clear to me that C++ is a valid alternative to C for embedded in practice. If one only has old non modern non compliant c++ compilers and toolchain, lack of libraries, why bother ? So before thinking about how to talk to C users, the C++ foundation/community may want to appraise the situation & see whether it is possible to get embedded compiler writers to provide a decent, modern c++ toolchain.
@dhombios5 жыл бұрын
Silmarieni C, I think that’s the main reason why c++ is not so used in embedded programming. Most toolchains provided by microcontroller manufacturers don’t have good c++ support, so you use c, as it is what your tools support (even if the provided tools don’t usually provide fully compliant iso c libraries either)
@keris39204 жыл бұрын
Take this with a grain of salt, because I realize it's probably biased. But I do embedded C++ programming every day for my job. We are forced to consider the available compilers when we design the hardware (for better or worse). But I think it's just ultimately something that you/your team should be considering in embedded applications. Ultimately, what matters is that your system performs the way you've designed it, and the compiler is a larger variable in that equation than a lot of people like to admit.
@childhood18882 жыл бұрын
Smart answer to "not so difficult question" 1:19:34
@sebastianschneider326 Жыл бұрын
Being a professional programmer in the embedded environment, unfortunately that trend that the c++ popularity goes down still is a thing
@yutubl2 жыл бұрын
@world views: Yes psychology of communication between communities vs. individuals have complexer rules. The here shown diagram can help, but should not be misunderstood sorting peoples mindset in static categories like hierachical-egalitarian/individual-community. Peoples mindsets are not static and evolve over time and/or change depending on the view/perspective to a given problem, people are able to use a total different mindset compared to a different problem.
@guiorgy3 жыл бұрын
9:46 He meant 2010
@jonathanccast5 жыл бұрын
9:16 - if C++ is not easier to use than C, it is a failure
@stefanluginger36825 жыл бұрын
Jonathan Cast for me. Learning C was much easier and it I felt like I got a good overview of the ideas of the language designer. In C++ and even after reading Biarne S. books I still think C++ is full of good ideas but it’s ugly, inconsistent and has lots of features no one can fully use in the way they were designed.
@mrlithium697 жыл бұрын
watch the first 22 minutes on 1.5x then skip to 41 minutes and keep going on 1.5x. Great stuff at 56:15 too
@martinkunev99115 жыл бұрын
Says if you're arguing you're losing and goes on arguing.
@ckgrier27 жыл бұрын
Maybe the trends could be explained by looking at what is currently called "embedded." If you are developing in Linux or Android, you may be doing the same kind of products, but might not call it embedded.
@H2CO3Szifon8 жыл бұрын
at 18:20: nope, they're not arguing that "using C++ for writing lightweight classes is not an appropriate use of the language". They are arguing that this is a microbenchmark, and not a big production system. And indeed, microbenchmarks often have very different results and outcomes than real-life scenarios, even if said big real-life project is composed of simple and small classes.
@apojoga2 жыл бұрын
Wouldn't the examples he brings up be covered by a static analyzer/linter type of tool? The problem with introducing C++ is that it's like putting a naive person in the garden of Eden -- they'll bite off more than one can chew.
@zxuiji Жыл бұрын
For me the reason I prefer C is simple, with C it's easier to understand WHY something went wrong when it does go wrong, with C++ you have to dig into implementations, assembly, and sometimes confounding classes or syntax, for example what the hell was wrong with casting with something like (long) that you had to go and make a stupidly long & seemingly pointless name like reinterpret_cast??? If a developer didn't understand what a cast was then get them the f**k out of your project because they're a landmine waiting to happen. I'll admit try/catch/finally, classes & templates are useful features I WISH were supported by C but not to the extent of the nightmare that is overloaded functions, weird ways to cast, innately incompatible with C returns, you HAD something good, then you ruined it
@massimo67673 жыл бұрын
Loved the talk but as always the speaker won't really answer the questions they are asked
@DavidMayolaTorres8 жыл бұрын
I would love to know his psychology bibliography, references, and so on
@markg7352 жыл бұрын
@26:22 - Thanks to that man we don't have to worry about programming embedded systems anymore because there are no SoCs available to program.😠
@burningglory23732 жыл бұрын
Cpp is cool and all. Until the microprocessor only has a c compiler.
@BruceBigby5 жыл бұрын
Hmm. I would add that if you're using the word, "should", which implies judgment, you're losing. Use suggest ot recommend and don't leave it to the audience to determine why. Tell them why! Also, you can use function pointers in C easily, you know, and even polymorphism, if necessary. Lastly, although he established successfully that C++ is a viable option for embedded programming, he conspicuously did NOT explain why C++ had a slight performance advantage over C in his test results, and because it appears to be counterintuitive, he has a responsibility to explain why. I suspect that he knew that the C community would cry foul and would respond by showing how minor legitimate adjustments in the C code might enable it to match or exceed the performance of C++. Consequently, he loses most of the C audience.
@SoulofAnotherDeity8 жыл бұрын
The problem with this guy's arguments is that he uses C++, written like C, to defend C++ usage. The fact of the matter is that actual C++ code (in practice) takes far longer to write, is tightly coupled, and is much more difficult to test and debug (especially memory usage). When you use the standard library, it screws up things like internationalization and the containers aren't suited for anything outside of the most basic of uses. Ultimately, what you find is that for every problem C++ sorta-solves, it tosses 3 more problems into your lap. Using C allows you to reason about your code. I can use static declarations for encapsulation and opaque structures for data hiding. I can use function pointers and tagged unions for polymorphism. Considering the fact that I would avoid using RAII, exceptions, and templates in C++ anyhow, C++ doesn't have a single feature that I don't already have. It just increases friction and makes me unproductive. I personally don't appreciate the 30min lecture trying to psychologically dissect and discredit any opinions of C++ being a bad choice as irrational.
@charlesd45727 жыл бұрын
No but he didn't show the C code in full. Be wary the guy is religious about C++. "university course who used C++ as C with classes" You mean structures with methods.
@keris39204 жыл бұрын
@LunacyStudy I would think you'd want to take advantage of templates if you are using polymorphism. Static interfaces are super powerful and efficient, and honestly provide better compile time checking than almost anything C has to offer. There are some risks associated with code size on embedded systems, but the speed and safety of templates are worth the extra effort needed to reduce the size. Runtime polymorphism using virtual functions usually leads to situations where I am on the phone with a customer or applications engineer trying to solve bugs after hours.
@amadlover4 жыл бұрын
I actually switched to c++ for a hobby project, for a while after watching this … :D
@chengyanslc3 жыл бұрын
Probably only takes to convert one person..
@nextlifeonearth4 жыл бұрын
Why I prefer C over C++: C++ isn't as portable or universal as C. If I want to use rust or whatever I would need to make a C header before I can make any rust bindings. It's especially bad if the header has templates or any sort of "modern" C++. C++ programmers act as if it's the centre of the universe, because C is popular and it supports C plus a lot of other features. If you don't want those features, they act as if I have any control in what is going to be used in a shared codebase. I don't, and once one of those problems caused by C++ starts to get in the way, it's too late. it fucked everything is touched and fixing it is as much work as rewriting it. It's technical debt++. There are features that I would really appreciate, but the presence of the unwanted catastrophic features are a deterrent. Nein danke.
@joe-ti8rz7 жыл бұрын
still learning
@alles_muss_anders_werden3 жыл бұрын
The whole Linux Kernel is written in C, not C++ ...
@gzozulin8 жыл бұрын
"We are smoking and this is bad, but instead of quitting, lets convert more people into smoking, so our charts will look in our favor" :)
@constantinqueins93134 жыл бұрын
sehr informativ
@DrOggy676 жыл бұрын
C++ becomes more and more like all the other object oriented languages like Java and C#. So nobody in our company is programming in C++ anymore. Most projects switched to Java. People learn Java at the university. Also the combination of Python an pure C (for the time consuming functions) is often used, especially in the whole big data segment. C++ brings more problems than it solves. As a programmer, I want to solve my current problems, and I don't want to spend hours in understanding cryptic template constructions or never needed rvalue references.
@isodoublet5 жыл бұрын
" C++ brings more problems than it solves. As a programmer, I want to solve my current problems, and I don't want to spend hours in understanding cryptic template constructions" Templates are there to make your life easier. Don't like them, don't use them. " or never needed rvalue references." Rvalue references are an optimization. Don't want them, don't use them. I fail to see how tying your hands behind your back and forbidding yourself from ever using rvalue references or templates helps you as a programmer.
@stefanluginger36825 жыл бұрын
Yes. I also noticed that Java and Python together with C is used in many companies.