Is C++ better than C?

  Рет қаралды 39,406

Tsoding Daily

Tsoding Daily

Ай бұрын

Streamed Live on Twitch: / tsoding
Enable CC for Twitch Chat
Panim Playlist: • Panim
Support:
- BTC: bc1qj820dmeazpeq5pjn89mlh9lhws7ghs9v34x9v9
- Pay for my VPS: zap-hosting.com/en/shop/donat...

Пікірлер: 286
@froop2393
@froop2393 Ай бұрын
Sorry to say that your videos aren't recreational at all... They are highly educational and I learn a lot from them. Thank you so much!
@AlessandroStamatto
@AlessandroStamatto Ай бұрын
1:44:30 "No, C++ was not better than C for this project."
@skeleton_craftGaming
@skeleton_craftGaming Ай бұрын
he implemented oop..
@bofa-zi4fj
@bofa-zi4fj Ай бұрын
@@skeleton_craftGamingjust because another language comes with one specific functionality does not automatically make it better for the project.
@rusi6219
@rusi6219 Ай бұрын
@@bofa-zi4fj yeah, also most learning resources for C++ present OOP as the default so that's what people typically end up implementing whether they intend to or not.
@skeleton_craftGaming
@skeleton_craftGaming Ай бұрын
@@bofa-zi4fj I agree . But When the other language split from The language that you're using specifically for a feature that you were required to implement (for your algorithm to not crash) then it might [I wouldn't say that it necessarily does but it might; and it does in this case (Because C++ is objectively better language [as unpopular as that may be)]
@mattshu
@mattshu Ай бұрын
@@skeleton_craftGaming ]*
@DogeOfWar
@DogeOfWar Ай бұрын
If you used the C-style "virtual" functions where they are beneficial and use C++ specific stuff where it's beneficial then you are still writing C++, the best C++ devs know when to use certain features and when to fall back on "raw-dogging" it. that is a strength of the language imo
@chepossofare
@chepossofare Ай бұрын
That's exactly why C++ is a disgrace.
@rogo7330
@rogo7330 Ай бұрын
So, strength of the language is that it compiles to the ELF file?
@Spartan322
@Spartan322 12 күн бұрын
Just want to point out as well it is provably impossible to distinguish the performance of a guaranteed C++ virtual table function call compared to a standard function call regardless of optimizations. (there is no generic benchmark for which you can guarantee either is more performant, its functionally random chance) Course the compiler could optimize out virtual calls in C++ which C can't do. Advantage of C however could be the lack of needing to address name mangling by default, that's the only big advantage otherwise. (though that is useless if you aren't producing a C ABI, and you can do it in C++ with little hassle even still)
@grenadier4702
@grenadier4702 5 күн бұрын
​@@rogo7330 What are you even talking about? Your comment doesn't make any sense
@NoizyCr1cket
@NoizyCr1cket Ай бұрын
36:24 "Barney Soursoup" 🤣
@pyajudeme9245
@pyajudeme9245 3 күн бұрын
Barney Starsoup was even better hahaha kzbin.info/www/bejne/e5DcepJ3qaapeJosi=VzWtikwuPAIXnVLH&t=2752 - 45:50
@stolenlaptop
@stolenlaptop Ай бұрын
"C sucks... But a little less than everything else"... Some random Internet guy.
@cobbcoding
@cobbcoding Ай бұрын
C is the worst programming language except for every other programming language.
@SimGunther
@SimGunther Ай бұрын
@@cobbcoding Which is why C is a lingua franca and making a transpiler that generates C++ code is a futile effort. Ask Andreas Kling and what happened with Jakt.
@blastygamez
@blastygamez Ай бұрын
C is the best programming language.
@valizeth4073
@valizeth4073 Ай бұрын
Except that isn't true at all, 60 years of language development and it's practically unchanged. C23 is praised to the heavens and they added roughly 5 valuable additions.
@rusi6219
@rusi6219 Ай бұрын
@@valizeth4073 precisely; it's not bloated to hell like C++ is.
@saidwho9891
@saidwho9891 Ай бұрын
1:01:00 Lol, we can already tell that C++ is worst than C, cause you're already starting to ask yourself "should I make this public or protected", and fall in the C++ dilhemma of philosophizing about objects 😂
@scattermc
@scattermc 12 күн бұрын
Facts, thats why i chose C. I am just starting in the world of "C" but i still dont see myself ever goin back to OOP so C++ can kiss my ass. It makes Java look good in my opinion
@exosdel
@exosdel Ай бұрын
Love ur vids on C, keep them comming!
@grimvian
@grimvian 11 күн бұрын
Two years of learning the basic C++ stuff like inheritance, composition and of course the weird cout. Then I started to investigate chrono compared to time in C. That made me finally realize, that I'm not compatible with C++. Now two years in C and with the video by Eskild Steenberg 'how i program c', and it's great.
@Rose-ec6he
@Rose-ec6he Ай бұрын
You missed out linking the source in the description today, i dont know if that was intentional or not. I personally find it extremely valuable, i have learnt so much from being able to follow along with your process by video and consulting your source when I mess up any details or want a rough idea of conventions to follow. Obviously, I don't expect this of you but if this was a slip-up, here's your opportunity to fix it. Anyway, love your content. Thanks again
@user-do4fm1nz2f
@user-do4fm1nz2f Ай бұрын
There is an useful technique called CRTP - static polymorphism. It allows you to write compact OOP code and doesn't raise problem with func pointers invalidation.
@danielarf4409
@danielarf4409 Ай бұрын
show me the book!
@Spartan322
@Spartan322 12 күн бұрын
Can't wait for the day of deduced this in all major compilers to fix 95% of CRTP use.
@Cmanorange
@Cmanorange Ай бұрын
26:10 raysan appreciation post
@prof.dr.davidbuzatto
@prof.dr.davidbuzatto Ай бұрын
I'm a C enthusiast and the only thing I miss is a standard implementation of the elementary data structures like lists (stack, queue, deque, list), priority queues, sets and symbol tables (red-black trees and hashtables).
@rusi6219
@rusi6219 Ай бұрын
LISP programmers be like:
@xravenx24fe
@xravenx24fe Ай бұрын
There's nothing wrong with scouring the web for libraries to accomplish the same purpose a standard library does. You can always write your interfaces to bypass libs and replace them with your own code later, it's not like you're getting by without platform specific or 3rd party libs in any serious project anyway.
@Eugensson
@Eugensson Ай бұрын
... you can find the answer to this and other questions in our new issue of “NO!”. Coming in June.
@pookiepats
@pookiepats Ай бұрын
El oh el
@GoldoEb
@GoldoEb Ай бұрын
1:26:00 BTW, you can also specify the name of the "X" macro. Just use the macro parameters like in the following example. #define LIST(handler_) \ handler_(banana) \ handler_(apple) \ handler_(cherry) And now you can have multiple different X-macros (handlers) and each of them will be defined.
@hedlund
@hedlund Ай бұрын
Ooh, never came across that before. Cheers!
@saidwho9891
@saidwho9891 Ай бұрын
Yes, this is less known but you can pass the second macro name as an argument, just not sure if this is 100% standard
@hedlund
@hedlund Ай бұрын
@35:00 (-ish): Have you done any streams or vods on Rust/C interop specifically? If not I'd love to see it, at some point :) Edit: Also, wasn't Soursoup head of programming research at Bell Labs for a long-ass time?
@pyajudeme9245
@pyajudeme9245 4 күн бұрын
Nowadays, my favorite channel! Awesome video (except that Python thing hahaha)! Mad respect for doing your videos live as a not native English speaker!
@MrMeltdown
@MrMeltdown 29 күн бұрын
29:42 I spent many hours in a pub reading through the C++ books understanding this... that along with move constructors etc.... Then you embed that lot in some Templates and you have entered a new layer of &&& ... hell. People have a problem with perl... It is no where near that bad. Tbh.
@opsJson_
@opsJson_ Ай бұрын
why not set the functions pointers again on hot reload? I mean, u already rebuild the vtable on hot reload
@kibels894
@kibels894 Ай бұрын
I work on a project with a C engine and C++ plugins. If you don't care about what happens with exceptions/signals it's fine but shit gets messy when it has to cross from one runtime to the other and back.
@John-yg1cq
@John-yg1cq Ай бұрын
I guess the next logical step is to define a pointer to another class that is kept in the application state that contains those function pointers instead of the built-in vtable, and then leverage C++ shenanigans to make that easier?
@TheJanhalsema1
@TheJanhalsema1 Ай бұрын
Depending on your definition of better, arguably, C++ is always better. You can just use it as C and only add the bits you like e.g. constexpr / templates / operator overloading and such. In recent years C++ even got the long standing missing bits from C like named struct initalization.
@meme-vw1vi
@meme-vw1vi Ай бұрын
i agree
@StevenMartinGuitar
@StevenMartinGuitar Ай бұрын
Was going to make the same point, you can 'pretty much' always use C++ and if you feel like only using C you just type it and it works. Besides people only get stuck with the messiness and complexity of C++ because they chose to use those features of C++ to begin with. You can just choose not to use them and go about it the C way instead.
@TurtleKwitty
@TurtleKwitty Ай бұрын
Same order only named struct init but mostly yes
@araarathisyomama787
@araarathisyomama787 Ай бұрын
Always better? Risky argument. It could be true if C++ compilation wasn't so dog slow compared to C and it gets exponentially worse in big projects if you're not actively preventing this problem and almost nobody is. So, if one's target style is very close to C either way, there is an incentive to drop "pp" from the source files. Performance is another rabbit hole where every good argument must be post-fixed with several layers of "but sometimes" or "but actually". Honestly I think it's almost a tradeoff. Experienced C programmers are used to manual labor in C, but they get much simpler language in exchange, they get really good at whatever they do and they do stuff that seems "hard", "unnecessary" or "not idiomatic" for C++ programmer automatically. EOT On the other hand all C++ programmers had to invest years learning the language that they will never understand fully, nor compilers will be able to implement consistently, as long as committee is extending it every 3 years... in exchange you get a language that can not only implement anything, but be written in any paradigm - to certain extent. Quite honestly if you get over this very high barrier I think you can implement anything pretty fast and in a syntactically verbose, but elegant at times, way, subjectively better than C - focusing a little bit more on the idea, than raw implementation - in a way. Expressing intent is a buzzword for C++ programmers. Yet, for traditionally C programmer those things seem actually "hard and unnecessary" and create a bigger cognitive overhead than the alternative of "just writing some more C code". Who is right? Is anybody wrong? I will probably get ran over in a minute
@misisumegi6138
@misisumegi6138 Ай бұрын
im not 100% sure i assume it crashes because you unload the dynamic library and thus the pointer to the vtable is invalidated (sorry i didn't fully watch the previous episodes) to update to it i think the simplest way would be to create a copy of each element but there are 2 problems 1 there are no virtual copy constructors 2 you cannot use polymorphism because the vtable is outdated at minimum now the best way i can think of solving this is creating a copy factory function that auto registers new classes using CRTP and identifies types using typeid but im not sure if it would work i will try to implement it by the next vod and report about it
@markmckenzie5343
@markmckenzie5343 Ай бұрын
44:18 the way you said "pure" lmao
@xavierthomas1980
@xavierthomas1980 Ай бұрын
C++ is way better, but also more complicated. It provides a lot of great ways to use a foot gun to shoot yourself in the face. However what you do in C compiles in C++, templates are better and safer than macros, OO is often bad but most abstractions have also very good use cases. You just have to learn how to use C++ correctly. This is (almost) feasible in a lifetime. The bad is not the fault of C++ but of the user of it.
@rusi6219
@rusi6219 Ай бұрын
Only C89 compiles in C++, not C95 or anything more modern. And having a million ways to solve 1 problem is not a good thing; for every potential "solution" you have ten issues you have to think about. And figuring out the right solution to the given problem becomes increasingly difficult the more "solutions" you introduce.
@miroaja1951
@miroaja1951 Ай бұрын
C++ is definitely one of those fine art languages, almost impossible to write well, but when it is written well it is really something. It's absolutely plagued with a bunch of unnecessary bloat brought on by years of iso-wack stuff, but it has a relatively simple core that can do absolutely anything and everything. In a way c and c++ have a lot of similarity in the vibe department aside their syntax and rules. To a C programmer c++ often feels bloated, unintuitive and like it's trying to always be smarter than you. To a C++ programmer c often feels contrived, stale, and pointlessly restrictive. Both are an absolute skill issue and from an outside perspective seem like a meaningless squabble. C++ has its place in building things, C also has its place. You can use either, you can use both, just don't footgun yourself like you can in both.
@rusi6219
@rusi6219 Ай бұрын
@@miroaja1951 neither is a footgun stop telling yourself that to make yourself feel more clever than you are. And C++ devs have a tendency to write "clever" code that is near impossible for any third party to comprehend - that is not a skill issue, it's what bad practices coupled with bloated languages (and ego) lead to.
@miroaja1951
@miroaja1951 Ай бұрын
@@rusi6219 did you actually read what I was saying or did you just want to be angry at someone?
@Henry-sv3wv
@Henry-sv3wv Ай бұрын
why use unsafe c++ if we now have a safe rust
@antonpieper
@antonpieper Ай бұрын
`override` implies `virtual`, so you only need to put `override` on member functions in child classes
@Argoon1981
@Argoon1981 Ай бұрын
override keyword, is not available in older c++ code bases, it exists only since c++11.
@antonpieper
@antonpieper Ай бұрын
@@Argoon1981 you should be using C++11 or newer
@Argoon1981
@Argoon1981 Ай бұрын
@@antonpieper That is not always a option, because of required libraries that never got updated, there's people still locked on c++03 code bases and they will be for many more years.
@saidwho9891
@saidwho9891 Ай бұрын
one of the big issues you gonna have with C++ variadic templates is the error messages lol, that's why i think instead you can have parameter pack of Task*... args
@saidwho9891
@saidwho9891 Ай бұрын
26:15 Honestly, the only reason you have to convert your libraries to C++ style is that they are header-only libraries, if you separate implementation into .h and .c you can keep using all the C features and still being compatible with C++ or any other systems language.
@babenoff
@babenoff Ай бұрын
Daesh horoshii uchebny jazyk😮
@danopamine
@danopamine Ай бұрын
haha not a fan of python myself but you joke ranting about mentioning "a toy language like python when discussing system languages" just remined me of John Carmack who was asked what programming language he currently loves the most and he responded with python lol :D
@apenaswellignton
@apenaswellignton Ай бұрын
POG
@mrmaniac9905
@mrmaniac9905 Ай бұрын
that title made me have an audible gasp. you scared me tsoding, you scared me.
@trwn87
@trwn87 Ай бұрын
C is cool because it's challenging. 😎
@rubyciide5542
@rubyciide5542 Ай бұрын
Yeah right manually flipping bits inside a flipflop is easier so its trash
@depralexcrimson
@depralexcrimson Ай бұрын
@@rubyciide5542 manually sending electrical inputs through a baseboard is way more challenging so that is trash too.
@DiegoSita
@DiegoSita Ай бұрын
​@@depralexcrimsonmanaging the velocity and directions of every single electron on a circuit is way more challenging so this is also trash
@Argoon1981
@Argoon1981 Ай бұрын
I don't agree at all, template heavy, virtual function crazy, exception madness, pure OOP c++, is way more challenging and complex. C functional/data oriented programing, is so much simpler, so much more fun to work with IMO.
@saidwho9891
@saidwho9891 Ай бұрын
@@rubyciide5542 U talking about a floppy diks ???
@pemrograman-cepat3393
@pemrograman-cepat3393 Ай бұрын
Wow. Your title is always legit 😮
@belst_
@belst_ Ай бұрын
Barney Starsoup is actually a genius
@HonsHon
@HonsHon Ай бұрын
Bourne Stopdrop
@ThomasLee-vs2gu
@ThomasLee-vs2gu Ай бұрын
@@HonsHon Bono Stopshop*
@dickheadrecs
@dickheadrecs Ай бұрын
@@ThomasLee-vs2gu Bong Supermarket*
@Phantom-lr6cs
@Phantom-lr6cs Ай бұрын
lol
@howdoiexitvim-sg2xl
@howdoiexitvim-sg2xl Ай бұрын
I didn't even notice until i read it like three times XD
@maxpoulin64
@maxpoulin64 Ай бұрын
I think the proper solution for the state preservation would be a custom allocator that keeps tracks of allocations like React hooks work: when reloading, the allocator just hands back out the same allocations in the same order so your state is preserved. Then you also get to detect when the data layout changes and force a full reload if the number of allocations change or the requested size changes. It still would break the objects though, so you'd also need to only do that for the state and have a separate struct just for state so you don't overwrite the vtable pointer. Fundamentally hot reloading native code without breaking pointers is hard.
@Spartan322
@Spartan322 12 күн бұрын
Technically messing with the vtable of an object at runtime is "portable" in the sense that every compiler that has support for virtual classes (thus having a vtable) can have the vtable pointer replaced at runtime. (this is necessary in order to actually support virtual classes being virtual) The standard doesn't ever really define vtables, so referencing them is technically UB, but in a technical sense so is #pragma once, regardless every compiler that has support for virtual classes can also read and reassign a vtable to existing memory blocks, vtables can't be manually defined but their functions can be reassigned and they can be retrieved. (actually technically they sort of can be created in a way, but good luck not creating a memory leak doing that, and there are a lot of protections around directly doing it) All these things are very finicky as you are technically violating a promise the compiler usually expects but so long as you're not doing anything that gets optimized out, and since no compiler recognizes the reassigning of the vtable as UB, it won't optimize out the vtable reassignment. (afaik, least in all the major compilers) A custom allocator is not strictly necessary, though perhaps more efficient depending on implementation. See www.moythreads.com/wordpress/2007/09/14/overriding-the-virtual-table-in-a-c-object/
@Argoon1981
@Argoon1981 Ай бұрын
I personally code c++, more or less in a C like way, using C++ ism's where they make sense and my life easy or where C ism's aren't supported, not cout/cin or streams either, printf all the way. I follow what is called unorthodox c++. I'm not saying is the absolute best way to code c++, is the way I like to code and the way that makes me happy and more productive and that is it.
@derekpmoore
@derekpmoore Ай бұрын
Yes
@alexpyattaev
@alexpyattaev Ай бұрын
Clangd LSP is quite good with c++ too
@justaszakarauskas6068
@justaszakarauskas6068 2 күн бұрын
C is GOD in the embedded world.
@FDominicus
@FDominicus Ай бұрын
As long as I can avoid C++ I will. And I can't see a change to needing it in my forseeable future.
@msxmlable
@msxmlable Ай бұрын
re-implement a poor man's COM, love it :)
@alanwest6949
@alanwest6949 Ай бұрын
Yes.
@Idiomeme_com
@Idiomeme_com Ай бұрын
Wow 1 hour
@FDominicus
@FDominicus Ай бұрын
Maybe you like to make this session with D? Or Objektive -C?
@nordgaren2358
@nordgaren2358 Ай бұрын
Oh no. Does he find out that vtables aren't FFI safe in this video?
@aniketbisht2823
@aniketbisht2823 Ай бұрын
Function overloading is also a nice feature that C++ have. Lack of it in C forces you to define functions as "sin, sinf, sinl" which is quite lame. C APIs like OpenGL are full of these functions which seems silly as a C++ programmer. Whereas in C++ it's just std::sin and it detects at compile time which version is appropriate and calls that. Using function overloading enables static polymorphism / pattern matching based on types and arity (the number of parameters that it takes). If there is any ambiguity it would result in compile error.
@Capewearer
@Capewearer Ай бұрын
I especially love the fact that some people hate operator overloading. That means they have never thought about clarity of syntax with long words (e.g. Matrix.addMatrix(Matrix_2) instead of Matrix + Matrix_2).
@aniketbisht2823
@aniketbisht2823 Ай бұрын
@@Capewearer std::chrono is also an excellent example where operator overloading makes everything simple and intuitive while providing type-safety without any performance loss.
@ElPikacupacabra
@ElPikacupacabra Ай бұрын
there's a `_Generic` macro for that 😉
@rusi6219
@rusi6219 Ай бұрын
So basically you like that C++ does the actual work for you? How lazy is that
@dysfunc121
@dysfunc121 Ай бұрын
@@rusi6219 Lazy can be good, efficient.
@TurtleKwitty
@TurtleKwitty Ай бұрын
To be fair to Bjarne, early C++ was crosscompiled to c so it would literally be a superset and full interop and then it stuck haha
@halfsourlizard9319
@halfsourlizard9319 6 күн бұрын
1) It was transpiled, not cross-compiled. 2) A is compiled to B does not imply that A is a superset of B.
@TurtleKwitty
@TurtleKwitty 6 күн бұрын
@@halfsourlizard9319 a) true, blanked on the right word B) it means that one can represent the other though
@redheavenhero7709
@redheavenhero7709 Ай бұрын
The reason behind inability to compile program with std::vector is an extremely messy design of initializer_list in C++ which poorly supports move-only types. And as far as I know C++ standardisation commitee explicitly refused to fix it.
@alf5197
@alf5197 Ай бұрын
initializer list's design in general is flawed in many ways, starting with the name. It's a hard thing to get right and it was introduced at the same time as all the other very hard to get right things in C+11 so I don't blame anyone but it's not ideal. there have been proposals to change this though www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4166.pdf
@ominusliticus8264
@ominusliticus8264 Ай бұрын
It makes no sense to copy construct, then there would exist multiple handles to the underlying pointer which defeats the point of calling it a unique ptr. Instead, you have to be sure to move or forward ownership of the objects throughout your construction or emplacement calls. I wrote another comment that gives two examples.
@redheavenhero7709
@redheavenhero7709 Ай бұрын
@@alf5197 The issue here is not that they didn't get it right on the first try but they don't want to admit it as a serious enough problem to be fixed.
@redheavenhero7709
@redheavenhero7709 Ай бұрын
@@ominusliticus8264 yes, it makes no sense to copy however it is behavior std::initializer_list enforces as it only provides const& access to its elements regardless its own qualification thus rendering initalization of std::vector from a braced list of elements impossible.
@jhi-42
@jhi-42 Ай бұрын
My first job was also C++ Qt. I try to forget it.
@RushFuture
@RushFuture Ай бұрын
What was wrong? I've using this tandem for 10+ years more or less successfully :D
@mwlulud2995
@mwlulud2995 Ай бұрын
​@@RushFuture why not use electron JS😉?
@RushFuture
@RushFuture Ай бұрын
@@mwlulud2995 mbedded, low resources
@qqshutup7175
@qqshutup7175 Ай бұрын
@@mwlulud2995 an engine to render a window, how wonderful... it's like epic games' launcher, a game engine to install a game, an installer that was supposed to have a maximum of 5MB becomes 150MB
@Henry-sv3wv
@Henry-sv3wv Ай бұрын
Is writing GTK GUI in c that much nicer? ( GObject ) or do you use vala?
@michaelmas9817
@michaelmas9817 Ай бұрын
yeah yeah, Java is just a subset of JavaScript
@joseoncrack
@joseoncrack Ай бұрын
🤣
@p99chan99
@p99chan99 12 күн бұрын
@ApolloJet86
@ApolloJet86 6 күн бұрын
Could somebody please explain to me what has happened from 13:03 to 13:18 like I'm five? It sounds interesting.
@SimGunther
@SimGunther Ай бұрын
Can your C do constexpr like C++ can? I don't think so!
@FlanPoirot
@FlanPoirot Ай бұрын
C23 has constexpr, it's deliberately made more constrained than C++'s version tho
@patboy24
@patboy24 Ай бұрын
⁠@@FlanPoirotwym more constrained?
@0xfadead
@0xfadead Ай бұрын
​@@patboy24 No compile-time crimes
@SimGunther
@SimGunther Ай бұрын
@@0xfadead Like what?
@rusi6219
@rusi6219 Ай бұрын
Having more poorly-implemented features is somehow supposed to be a w?
@halfsourlizard9319
@halfsourlizard9319 8 күн бұрын
Petition to have Bjarne change his name to Barney Starsoup!?
@MrMeltdown
@MrMeltdown 28 күн бұрын
In the earliest c++ you could write to the this ptr when you wanted to do in place new….
@TechTutor429
@TechTutor429 28 күн бұрын
Great
@origamitraveler7425
@origamitraveler7425 Ай бұрын
based
@inferrna
@inferrna Ай бұрын
Qt, Новосибирск... А не 2Gis ли это?
@TsodingDaily
@TsodingDaily Ай бұрын
Нет, это был Новокузнецк. Но в 2gis я тоже чуть-чуть работал.
@hughjass6928
@hughjass6928 Ай бұрын
Short answer is yes
@JerehmiaBoaz
@JerehmiaBoaz Ай бұрын
And the long answer is: yes indeed, the only problem C++ has is the burden of backward compatibility with C and old style C++ that makes the language unsafe and overly complex. What C++ really needs is Rust's "unsafe" keyword to tag all the legacy C and C++11 stuff people shouldn't use unless they know what they're doing (which 90% of them don't).
@ominusliticus8264
@ominusliticus8264 Ай бұрын
Not sure if you'll read, but to use `std::vector`, your plug_update function should call `std::make_unique(Move_Vec2(...))` for every new task, instead of `new Move_Vec2(...)`. The cleanest way is to then use fold expressions and `push_back` or `emplace_back`
@MG-yc6jr
@MG-yc6jr Ай бұрын
C++ is just a dlc of c
@Capewearer
@Capewearer Ай бұрын
More like Total Conversion.
@rusi6219
@rusi6219 Ай бұрын
@@Capewearer it's to C what The Frontier is to Fallout
@Capewearer
@Capewearer Ай бұрын
@@rusi6219 likely what Arcane Dimensions to Quake one is: the true sequel.
@rusi6219
@rusi6219 Ай бұрын
@@Capewearer I think you mean to say what crack life is to half life.
@Capewearer
@Capewearer Ай бұрын
@@rusi6219 that's true for Rust.
@buriedbones-nh9xr
@buriedbones-nh9xr 16 күн бұрын
Its the same as askin if a V8 is better than a V4 engine. Technically it is but its much more dangerous to drive a V8, and if you screw up with a V8 its much more disasterous than screwing up with a V4. Its not the best analogy
@RandomGeometryDashStuff
@RandomGeometryDashStuff Ай бұрын
31:31 will `(decltype((da)->items))` preprocess to `()`?
@TsodingDaily
@TsodingDaily Ай бұрын
Yeah, I already fixed that.
@levvayner4509
@levvayner4509 Ай бұрын
It's amazing how much effort you can exert if you don't want to write a few lines of CSS to achieve the same goal. Great video!
@dvillegas
@dvillegas Ай бұрын
Oh god not Qt, anything but that, we have a legacy app at work on Qt, I have no fucking clue what it does or how it does it and touching it terrifies me everytime
@vladimirkraus1438
@vladimirkraus1438 Ай бұрын
That's not a problem of Qt but the problem of your badly designed application or your lack of understanding of Qt. Qt is still (one of) the best tool for professional grade desktop applications.
@friedrichmyers
@friedrichmyers Ай бұрын
My rule is simple. Write C in C++ and if things needs to be bananas, use C++ features. I still don't write classes unless I HAVE to. I don't use the new C++ std library functions unless I HAVE to.
@tapwater424
@tapwater424 Ай бұрын
I add templates to all my functions to increase compile times by 1000%
@John-yg1cq
@John-yg1cq Ай бұрын
Only problem is that C++ hijacks Structs and turns them into classes with public by default semantics. (Including Vtables, constructors, destructors etc. etc.) Essentially, you loose the default C PoD struct. There's probably some ways to get it back, but that's not obvious to the new developer.
@friedrichmyers
@friedrichmyers Ай бұрын
@@John-yg1cq Yes that is a problem but it doesn't hinder much of my performance because C++ isn't Python. And I stick with "hacky" ways of doing things unless I really have to decide on properly making a class and its respective methods. Many games use virtual tables and they are still fast enough. Because C++ is a highly optimized and fast language with modern features And it is not Python or Javascript, ofcourse. I use structs as a way to just group some variables. That's all that is for me.
@charlieking7600
@charlieking7600 Ай бұрын
​@@tapwater424it's worth the wait. And the main trouble of C/C++ is header system. You can read the story of Ingo Molnar, who wrote patches for Linux kernel just to speed up enormously slow compilation. E.g. Java and Pascal have module system, which allows for much faster compilation.
@John-yg1cq
@John-yg1cq Ай бұрын
@@friedrichmyers There was a paradigm shift in gaming I heard, C++ dominated the 2010s but now we're seeing a bit of resurgence towards C. Still, it's mostly becoming a problem when you go nitty gritty into the details, I agree. But selling C++ structs as C structs is *technically/achtually* incorrect. :^)
@user-nt1uf4gl1i
@user-nt1uf4gl1i Ай бұрын
почалось)
@MrKevinontube
@MrKevinontube Ай бұрын
Script tcl Bebe has got your back.
@Guilty-vv7xl
@Guilty-vv7xl 23 күн бұрын
TCL is hell 😭
@kirillratkin1590
@kirillratkin1590 Ай бұрын
Maybe Zig will save this World ;)
@vincentl7022
@vincentl7022 Ай бұрын
I was looking for that comment thanks
@Painple
@Painple Ай бұрын
I like C# more than C++. Nice video as always 👌
@OREYG
@OREYG Ай бұрын
Those languages are incomparible
@dutchdykefinger
@dutchdykefinger Ай бұрын
i never really did much c# but i did javascript/ecmascript so i actually kind of did as tons of shit is lifted from C# lol i guess typescript is even closer seeing as it actually has hard typing lol
@meme-vw1vi
@meme-vw1vi Ай бұрын
@OREYG what makes you say that?
@Henry-sv3wv
@Henry-sv3wv Ай бұрын
they say vala is like c# but compiles to c and makes GObject GTK GUI programming more easy
@rssszz7208
@rssszz7208 Ай бұрын
Am learning cpp hope it helps😅
@shrddr
@shrddr Ай бұрын
Barney Soursoup 🤔
@Phantom-lr6cs
@Phantom-lr6cs Ай бұрын
lol
@cobbcoding
@cobbcoding Ай бұрын
C wins yet again
@RajVishwakarma-jt4kw
@RajVishwakarma-jt4kw Ай бұрын
What is his real name 🤔?
@SimGunther
@SimGunther Ай бұрын
Alexey based on his commit history
@cobbcoding
@cobbcoding Ай бұрын
zozin
@nobodyspecial1553
@nobodyspecial1553 Ай бұрын
I just like writing code in C. That is all. I make no claims about superiority. I'm a guy who programs for pleasure. 😏
@dutchdykefinger
@dutchdykefinger Ай бұрын
my c++ code is filled with standard C library shit lol, it's deceptively close to ansi C under the hood the way i play with it lol but man i love the namespaces, i kind of use them as (strictlt public) classes to organize and categorize my codebase, but it's mostly just good old structs and pointers under the hood, i don't even bother with c++ class implementation, but i do love the namespaces
@xxMKtooStronk__
@xxMKtooStronk__ 6 күн бұрын
So you need 1 hour and 46 minutes to say is c++ better than c. Can you just say yes or no?
@ZoraAlven
@ZoraAlven Ай бұрын
44:22
@nordgaren2358
@nordgaren2358 Ай бұрын
I recently had to model C++ "inheritance" into Rust, so that I could "make" C++ structures in Rust for patching Elden Ring. It was pretty cool! There's some pain points in Rust. Mostly just stuff that has to be done manually. I could imagine C is even more painful in that regard.
@rusi6219
@rusi6219 Ай бұрын
Well if you tried C you a) wouldn't have to imagine and b) find out that you're wrong
@nordgaren2358
@nordgaren2358 Ай бұрын
@@rusi6219 I have done it in C for less complicated projects. How am I wrong ? You literally have to do things more manually in C.
@Henry-sv3wv
@Henry-sv3wv Ай бұрын
@@rusi6219 c and c++ is unsafe
@BobChess
@BobChess Ай бұрын
C++ can do C but C can't do C++
@dutchdykefinger
@dutchdykefinger Ай бұрын
well that can't be entirely true C++ was literally a C library for over a decade at bell laboratories, until c++ was standardized to its own standard in 1998 lol of course C compilers were updated with new tricks to support more things for the library in C as it evolved, before c++ became its own thing but it was still a newer ISO standard of C rather than a C++ compiler. before 1998, C was the only one that could do C++ lol there's a reason pretty much every C++ compiler can compile C, they wouldn't all go out and implement backward support for C in their C++ compilers for shits and giggles, it was already there because it evolved from C that's pretty much the only reason they almost all can and do, C is the cause, not the effect lol
@oraz.
@oraz. Ай бұрын
C is more enjoyable. Objectively I dunno.
@Phantom-lr6cs
@Phantom-lr6cs Ай бұрын
c is more easy that's all and it's not complex as c++
@rusi6219
@rusi6219 Ай бұрын
@@Phantom-lr6cs complex with bloat is bad, not good.
@SeattleSpursFan1882
@SeattleSpursFan1882 Ай бұрын
@16:36 "Symbol mangling is done by C++ because the linker only supports a global namespace". - The Secret Life of C++ - Symbol Mangling. The chapter explains all the nitty gritty details of C++ symbol mangling. Quite interesting and informative.
@mhalton
@mhalton 4 күн бұрын
The only one worthy of applause is C.
@epic_gamerXD12345
@epic_gamerXD12345 Ай бұрын
No
@GillesLouisReneDeleuze
@GillesLouisReneDeleuze Ай бұрын
oh yes my favorite language zeep-zeep lus-lus
@potatomaaan1757
@potatomaaan1757 Ай бұрын
1:23:43 X-Potato (only real Gs will get this reference)
@wlcrutch
@wlcrutch Ай бұрын
No.
@twsnake2011
@twsnake2011 2 күн бұрын
C++ is the best
@aniketbisht2823
@aniketbisht2823 Ай бұрын
Macros's are poor man's templates for generic programming and meta-programming. Not having constexpr (compile-time computation) is a huge downside for C. C23 introduced constexpr but those are only "variables" a.k.a constants not "computation". And lack of "constexpr if" means you can't make compile time decisions with them. For that you still rely on the pre-processor (#if def's). These two features alone enables you to write libraries like std::chrono and fmt. Both of which are better than their C counterparts : and . They catch many errors at compile-time and generate better assembly (due to eliding computations which could be done at compile-time). You are passing floats every in the name of "seconds". The only thing backing it up is the documentation (if any). std::chrono::seconds performs all the checks and conversions for you without any loss of performance.
@patrickjdarrow
@patrickjdarrow Ай бұрын
Me watching this as a python script kiddie 👁️👄👁️🍼
@gagagero
@gagagero Ай бұрын
My dad is stronger than your dad.
@MrOnePieceRuffy
@MrOnePieceRuffy Ай бұрын
Whats this Question? A good language has a string class. Case closed.
@God-vl5tk
@God-vl5tk Ай бұрын
Not surprised by someone who says "Right" after every statement he makes.
@Nova32x
@Nova32x Ай бұрын
Is he wrong tho?
@RandomNoob1124
@RandomNoob1124 Ай бұрын
Bruh corporate engineers spam right after every statement at work holy shit it’s like shadow clones 🤦🏾‍♂️
@rogo7330
@rogo7330 Ай бұрын
One thing why people talk about C as "old" and "hard" just because libc is very old, full of bugs and most of the times inconvinient. I personally reference to it as "undefined code with global states library". Thankfully POSIX does include functions where you can provide a pointer to an instance of the state, thus having ability to do several things at the same time, but it is not everything at it honestly should be the default. If Python would not had a lot of predefined classes for strings and stuff it would be very annoying language to write in. Standart library of the language _is_ the language these days.
@matrixnorm6672
@matrixnorm6672 Ай бұрын
no
@Capewearer
@Capewearer Ай бұрын
...because it's MUCH better.
@danielmilyutin9914
@danielmilyutin9914 Ай бұрын
Provide the link to your code. Want to see what are you doing there with C++. Maybe (no promises here), will give you some advice how to improve it or to use idiomatic C++. Looks like your std::vector should be `std::vector`. This will relief you from writing destructor.
@pavelperina7629
@pavelperina7629 20 күн бұрын
My takes, I don't want to watch two hours video: * C is much less complex, whereas C++ is like a mix of several languages (templates with specifics of C+11/C++17/C++20, several ways how to initialize variable with some side effects of {}) * C does not have RAII and relatively safe way to free resources by class going out of scope * conveniency of STL library despite some of it's design decisions are "weird" to put it mildly * There are edge cases when C++ is slower if you try to target them, but calling function/method (virtual or not) hundred million times in a loop is bad design regardless of the language
@Spartan322
@Spartan322 12 күн бұрын
Actually its been demonstrated that virtual function calls and function calls by themselves cannot be distinguished by performance at all. Its functionally random on modern hardware to determine which is more performant at any instance (ignoring what its specifically doing, I'm referring to the call itself) if you make a function call or a virtual function call in the machine code.
@inferrna
@inferrna Ай бұрын
C beats Rust, C++ beats C, Rust beats C++
@heco.
@heco. Ай бұрын
so like rock paper scissor
@rusi6219
@rusi6219 Ай бұрын
Actually Rust curls up into a corner and cries.
@arson5304
@arson5304 Ай бұрын
​@@rusi6219 why
@rusi6219
@rusi6219 Ай бұрын
@@arson5304 because of its atrocious userbase.
@huistelefoon5375
@huistelefoon5375 Ай бұрын
​@@arson5304afaik Rust is barely used in enterprise software, and it is significantly higher level. the comparison of C, C++ vs Rust is questionable
@astkh4381
@astkh4381 11 күн бұрын
React is better
@paladin80lvl
@paladin80lvl Ай бұрын
на сдинозавры пишут тыче бле
@ron3060
@ron3060 Ай бұрын
Cpp= C+Class 😎
@nirajandata
@nirajandata Ай бұрын
sorry, this terminology was only valid upto c++98
@dutchdykefinger
@dutchdykefinger Ай бұрын
fuck classes i only care about the namespaces templates can be handy in a pinch too :D
@valizeth4073
@valizeth4073 Ай бұрын
@@nirajandata Not even then really, it was only valid around 40 years ago when C++ was still "C with Classes" and still transpiled down to C.
@debooger
@debooger Ай бұрын
c++ nuuuuuu you fell off lmao
Async Engine in C
3:12:16
Tsoding Daily
Рет қаралды 43 М.
Can C actually do Perfect Bézier Curves?
2:17:22
Tsoding Daily
Рет қаралды 18 М.
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 90 МЛН
⬅️🤔➡️
00:31
Celine Dept
Рет қаралды 38 МЛН
ROCK PAPER SCISSOR! (55 MLN SUBS!) feat @PANDAGIRLOFFICIAL #shorts
00:31
Hot Code Reloading in C
2:16:18
Tsoding Daily
Рет қаралды 60 М.
Will Ada Replace C/C++?
44:57
Tsoding
Рет қаралды 84 М.
Why I Like Programming in C.
3:16
Francisco Jinto Fox
Рет қаралды 25 М.
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Рет қаралды 318 М.
Modern Software Engineering
0:40
ThePrimeagen
Рет қаралды 353 М.
What Is A Graphics Programmer?
30:21
Acerola
Рет қаралды 380 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Разряженный iPhone может больше Android
0:34
AI от Apple - ОБЪЯСНЯЕМ
24:19
Droider
Рет қаралды 128 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,3 МЛН