7 ms·
Talking to C Programmers about C++ [video]
- TempleOS 10y agofaggot
- jdmoreira 10y agoI'm still watching but it took an interesting turn at the 30 min mark :)
- partycoder 10y agoC++ is really hard. I have learned enough about it to understand that there's a lot of idiomatic ways of achieving things that I do not understand, especially with the latest standards. When someone claims to know C++, especially in a recruitment context, I tend to challenge that, since it's really hard to actually believe these days. Some people claim to know C++, but basically just write everything as if it was C.
- pjmlp 10y agoThe same is true of any language with similar history. Do you believe anyone knows Perl, Python, Ruby, Java, C#, Ada, Haskell, OCaml, VB.NET, F#, ... across all language versions, the whole standard library, and most used third party libraries? One always need to focus on a specific domain.
- daurnimator 10y agoFWIW, this is why I use lua as my primary language: it's the only language I can keep all in my head at once.
- 0xFFC 10y agoI would love to read about your experience with Lua. I always thought lua is for some limited things.
- daurnimator 10y agoWhat sort of thing do you want to read? I have tagged posts on my blog: http://daurnimator.com/tagged/lua http://daurnimator.com/tagged/lua but that's probably mostly library release annoucements.
- loeg 10y agoThe obvious comparison is C — where it is common to know 95-100% of the language. (The 5% I'd pick is general disagreement about expectations of UB and "weird" pointers, like pointers to array types.)
- pjmlp 10y agoPeople that don't write portable C code think that they know 95-100% of the language. I don't miss the days in the late 90's, early 2000, writing portable C code across multiple compilers from each OS vendor, across all major UNIX flavours and Windows. Many that think to master C, actually master C in compiler X targeting OS Y.
- loeg 10y agoWhat a sweeping generalization. Perhaps. But it's certainly easier to master portable C than portable C++.
- pjmlp 10y agoYes, that is quite true. However I prefer that pain, to the lack of strong typing that C++ offers over C. But better would be to use something else instead of C and C++, more type safe, without UB and without the wide range of implementation differences and compiler extensions.
- TickleSteve 10y agoC++ is not one language... there are many styles, for example: - 'C with objects'. - 'Everything is a template'. - 'Embedded C++' (its a real standard, google it). - functional. - 'modern'. (thats not a complete list either). Each one of those is technically the same language, but they're all using a different subset of features and are almost unrecognisable from the rest.
- partycoder 10y agoIt is one language. Many of those subsets are not mutually exclusive. Regardless of what your preference is, if you claim to know C++ you need to at least know some of its basic features, such as references, streams, templates, STL, etc. (features that have been around for a long time). And if you claim expertise, to at least be familiar with basic features from the new standards.
- TickleSteve 10y agotrue, they're all overlapping subsets.... The point being that the way you structure your software in each of those styles is very, very different. They're all idiomatic C++.... just different idioms. In fact, thinking about it, thats what it is... C++ is a multi-idiom language.
- ratboy666 10y agoSure, with an execution model that is so complex that it takes scientific experimentation to determine the /best/ (in terms of execution speed) to write code to manipulate a simple memory mapped device. (This, from the lecture). That is so complex, it is the only language that I need the language at hand to read someone else's code. Not a library reference, a /language/ reference. Indeed, I am maintaing one C++ application. This is a wrapper for CEF3 (https://cefbuilds.com/ https://cefbuilds.com/). This is the Chromium browser as a library. I have to support the library and wrapper on two platforms: Linux 64 bit and Windows 64 bit. Note that the usual Windows build uses the Microsoft C++ compiler. But, I am uses mingw. This requires source code edits to compile! I blame the complexity of the language. Indeed, C++ is so difficult that the shop I work for (which is, by the nature of our product, very conservative) has gone to Java instead.
- satysin 10y agoI have been programming in C++ for almost 17 years now and I would say I know maybe 20-25% at most. The reality of C++ is you know what is needed for the problem you need to solve. As people mostly work in the same (broad) areas for their day to day work it is unlikely you need to know outside of that scope regularly. At least not in my personal experience. Also I strongly believe nobody truly understands C++ streams :)
- blub 10y agoWhat are the components of C++ that add up to 100%? I can count: * language basics (variables, structural statements, functions, error handling, preprocessor, how compilation works) * OOP * functional programming (which is not that complicated at all in C++) * generic programming * advanced generic programming and metaprogramming * the C standard library * the C++ standard library basics (containers, algorithms, smart pointers, cout << "foo") * more advanced c++ standard library (maths stuff, threading(?), chrono, advanced streams (not needed)) I think most C++ programmers have a reasonable command of all of these except the metaprogramming and advanced standard library.
- satysin 10y agoYou just proved my point ;)
- blub 10y agoDoubtful. What would 25% of the above list be, basics + OOP? No standard library at all? No templated code? I am saying one can barely write programs by knowing just 25% of C++, let alone for almost two decades. On the contrary, I think 80%+ of the language is accessible to every programmer.
- AlexandrB 10y ago> On the contrary, I think 80%+ of the language is accessible to every programmer. 80% of the language looks accessible to every programmer. Until you hit some corner of C++ behaviour and you realize your mental model of what C++ is doing is woefully incomplete. C++ is stuffed full of syntax, and obscure interactions between that syntax will continually trip you up. Each of the things in your list is somewhat contained on its own but interacts in surprising ways with every other thing on that list. For example[1], want to create a template friend function for a template class? Prepare for function definitions like: Foo<T> f<>(); Edit: that's not to mention various C++ idioms like CRTP [2] which don't fit neatly with the stuff you listed but are non-obvious and occur in a lot of complex C++ code. [1] http://yosefk.com/c++fqa/templates.html#fqa-35.16 http://yosefk.com/c++fqa/templates.html#fqa-35.16 [2] https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern https://en.wikipedia.org/wiki/Curiously_recurring_template_p...
- RandomOpinion 10y ago>Some people claim to know C++, but basically just write everything as if it was C. Nothing wrong with that; that's not uncommon in embedded systems development.
- KayEss 10y agoScott Adams (Dilbert) has been writing extensively on persuasion for the last year or so, covering many of the same points Dan does. He has put together a reading list: http://blog.dilbert.com/post/129784168866/the-persuasion-reading-list http://blog.dilbert.com/post/129784168866/the-persuasion-rea...
- swah 10y agoIn his podcast episode with Tim Ferris he cites again Influence - by Robert B. Cialdini PhD
- FrozenVoid 10y agoOnly a handful of modern C++ features appeal to me. In order to use them, i actually have to use other features(less desirable, like templates or class inheritance) which create bloat, latency and corner cases requiring knowledge of the inner structure of the things(like variadic functions actually being variadic template syntax sugar). Ease of use which C++ brings is 'balanced' by opaque and hard debugging, large executable sizes and large memory use.
- KayEss 10y agoCan you give some concrete examples?
- FrozenVoid 10y agohttp://pastebin.com/fgPhGaxz http://pastebin.com/fgPhGaxz
- KayEss 10y agoPersonally I think that looks pretty good. There's no templates, no inheritance. Not sure what would make bloat there nor latency. Whatever the faults of the syntax for folding, it's got to be better than VA_ARGS hasn't it?
- FrozenVoid 10y agoHave you tried to compile and run it?
- adsofhoads 10y agoThere are templates: for example void print1(auto x){std::cout<< x;} is a function template template <class T> void print1(T x){std::cout<< x;} This is not valid C++14 however, so it doesn't compile. If you replace these, you'll probably still get a stack overflow while expanding the templates because there are almost 7000 arguments to a single function call.
- faragon 10y agoIn my opinion, many C++ projects would be simpler, cheaper, safer, and better maintained, if were written in C (with adequate libraries, e.g. for strings, vectors, maps, threads, timers, sockets, etc.).
- sseagull 10y agoA vector/map of what? How do I have a map of some key to a custom structure? How do you do this simply without templates? Separate libraries? Macro hell? How do you handle types which need to free memory without destructors? Manually loop over the vector and free stuff every time one goes out of scope? That doesn't seem safer to me.
- faragon 10y ago>>A vector/map of what? How do I have a map of some key to a custom structure? How do you do this simply without templates? Separate libraries? Macro hell? Separate libraries, without "macro hell". >>How do you handle types which need to free memory without destructors? Manually loop over the vector and free stuff every time one goes out of scope? That doesn't seem safer to me. Providing both heap and stack based allocation. E.g. allocating a vector in the stack would require no explicit de-allocation (example: https://github.com/faragon/libsrt https://github.com/faragon/libsrt). For heap allocation, you would need to call some sometype_free(&a) function, obviously (there is no RAII in C).
- deleted 10y ago[deleted]
- cturner 10y agoThe backfire effect has had a lot of airplay. I've just now made a quick scan of the study, but not read in detail (https://www.dartmouth.edu/~nyhan/nyhan-reifler.pdf https://www.dartmouth.edu/~nyhan/nyhan-reifler.pdf). I don't think the paper justifies its conclusion that "corrections [..] increase misperceptions among the group in question". From the paper, "In other words, the correction backfired – conservatives who received a correction telling them that Iraq did not have WMD were more likely to believe that Iraq had WMD than those in the control condition." (https://www.dartmouth.edu/~nyhan/nyhan-reifler.pdf https://www.dartmouth.edu/~nyhan/nyhan-reifler.pdf) I don't think that connection flows. Rather, I see this: when you take people who have developed political opinions, and act in a way that suggests insult to their world-view, some will react with defiance/sabotage. The study identifies the pre-existing political leanings of the subjects. Hence, background work has been done to understand a subject's political persuasion, and the subject knows they have been profiled for this. Then they isolate an issue which some subjects will know to be contentious across liberal/conservative lines, and present the subject with a position. This act (focusing on a vulnerable issue and then preventing evidence that indicates a clear conclusion) alienates the project from the subject, and sets them up to be from a rival worldview. Some subjects, particularly the more politically-aware subjects, will be speculating on the purpose of the study. Then the study asks the subject to - essentially - calculate one plus one one on the issue, towards a conclusion that supports the rival worldview. The people running these studies will be identified by the participants as members of the intelligentsia. That will have a bearing on subject behavior, and will further encourage defiance in some subjects. In my scan, I didn't see signs of effort made to disguise or water down the focus of the study.
- gravypod 10y agoThe problem with C++ is the constant introduction of unneeded features that are infinity obscure in necessity. People will say "Oh just don't use that feature" but that's not how this works. If something is there it is used. In reference to C, I don't think I know of a single feature or release that had major changes in how I wrote C. Maybe C99 and allowing me to declare in a for loop. I've been using C++ for class this semester and the only thing I like is reference types. Makes pointers much more concise. Other then that it can all go in the bin. In order to keep my C++ project clean I've needed to avoid a huge set of features and keep it in a data-oriented design.
- hackits 10y agoWhen I think about features in C++ that I would love to have in C, the only thing that comes to mind is constructors and deconstructions for RAII.
- Koshkin 10y agoProblem is, using destructors (and RAII) may have, in general, certain performance implications that C may not be willing to deal with. This is somewhat similar to demanding that C had a garbage collector built in. Note that, being lazy, memory management by means of garbage collection may turn out being more efficient than using the (eager) destructors.
- hackits 10y agoDon't see how there could be any performance implications with having RAII within C. It would be a simple method call with the this pointer to the struct during complication. Though if your performance consideration is at the assembly code level why use C? I've had some good/bad experiences with garbage collectors. They do help improve productivity and ROI within the enterprise space where memory isn't too much of of issue. Then when memory does become a issue within smaller memory footprint environments they can be a real pain in the ass.
- 10y ago
- wott 10y agoAfter 20 minutes spent complaining that nobody listens to him, several minutes of diversion to come to the point that people are not rational because they favour world view and moral sense (characteristics that he calls 'emotional') compared to self-interest, and that he finds that dismaying. Well, I am dismayed that one may consider prioritising selfishness and immediate interest as rational and prioritising global thinking as emotional, and not the opposite. And that is supposed to serve as an anchor to the following points. Well... Now at 30 minutes and the subject of the talk was barely tackled. I am not sure I have the strength to inflict myself the remaining hour.
- bischofs 10y agoIt seems like the minutia and subtlety of many c++ features at the cost of simplicity and readability lend themselves to cocky, in-love-with-themselves developers like this guy (who tells us upfront he wasn't actually building anything embedded in c++?!).
- knocte 10y agoThanks, you just saved an hour of my life :)
- hellofunk 10y agoI fail to understand why his discussion of the words "merry, marry, Mary" and photos of him with Biden and Obama had any relevance to this discussion. That was a very odd interlude in an otherwise fairly interesting talk.
- x0re4x 10y agoC++ Zealot Declares: C++ Declining In Embedded Because Not Enough Preaching To Resistant C Programming Infidels
- JohnLeTigre 10y agoYou won't convince me that c++ is as good as c simply by representing a plain old structure as a class or by talking about the type of arrays. To me, data-oriented design is more interesting: https://www.youtube.com/watch?v=rX0ItVEVjHc https://www.youtube.com/watch?v=rX0ItVEVjHc