Is C++ better than C?

  Рет қаралды 41,826

Tsoding Daily

Tsoding Daily

2 ай бұрын

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...

Пікірлер: 288
@NoizyCr1cket
@NoizyCr1cket 2 ай бұрын
36:24 "Barney Soursoup" 🤣
@pyajudeme9245
@pyajudeme9245 Ай бұрын
Barney Starsoup was even better hahaha kzfaq.info/get/bejne/e8WpfMJy2afacmw.htmlsi=VzWtikwuPAIXnVLH&t=2752 - 45:50
@froop2393
@froop2393 2 ай бұрын
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!
@grimvian
@grimvian Ай бұрын
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.
@saidwho9891
@saidwho9891 2 ай бұрын
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 Ай бұрын
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
@AlessandroStamatto
@AlessandroStamatto 2 ай бұрын
1:44:30 "No, C++ was not better than C for this project."
@skeleton_craftGaming
@skeleton_craftGaming 2 ай бұрын
he implemented oop..
@bofa-zi4fj
@bofa-zi4fj 2 ай бұрын
@@skeleton_craftGamingjust because another language comes with one specific functionality does not automatically make it better for the project.
@rusi6219
@rusi6219 2 ай бұрын
@@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 2 ай бұрын
@@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 2 ай бұрын
@@skeleton_craftGaming ]*
@DogeOfWar
@DogeOfWar 2 ай бұрын
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 2 ай бұрын
That's exactly why C++ is a disgrace.
@rogo7330
@rogo7330 2 ай бұрын
So, strength of the language is that it compiles to the ELF file?
@Spartan322
@Spartan322 Ай бұрын
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 Ай бұрын
​@@rogo7330 What are you even talking about? Your comment doesn't make any sense
@stolenlaptop
@stolenlaptop 2 ай бұрын
"C sucks... But a little less than everything else"... Some random Internet guy.
@cobbcoding
@cobbcoding 2 ай бұрын
C is the worst programming language except for every other programming language.
@SimGunther
@SimGunther 2 ай бұрын
@@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 2 ай бұрын
C is the best programming language.
@valizeth4073
@valizeth4073 2 ай бұрын
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 2 ай бұрын
@@valizeth4073 precisely; it's not bloated to hell like C++ is.
@exosdel
@exosdel 2 ай бұрын
Love ur vids on C, keep them comming!
@Rose-ec6he
@Rose-ec6he 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
show me the book!
@Spartan322
@Spartan322 Ай бұрын
Can't wait for the day of deduced this in all major compilers to fix 95% of CRTP use.
@prof.dr.davidbuzatto
@prof.dr.davidbuzatto 2 ай бұрын
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 2 ай бұрын
LISP programmers be like:
@xravenx24fe
@xravenx24fe 2 ай бұрын
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 2 ай бұрын
... you can find the answer to this and other questions in our new issue of “NO!”. Coming in June.
@pookiepats
@pookiepats 2 ай бұрын
El oh el
@GoldoEb
@GoldoEb 2 ай бұрын
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 2 ай бұрын
Ooh, never came across that before. Cheers!
@saidwho9891
@saidwho9891 2 ай бұрын
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 2 ай бұрын
@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 Ай бұрын
Nowadays, my favorite channel! Awesome video (except that Python thing hahaha)! Mad respect for doing your videos live as a not native English speaker!
@kibels894
@kibels894 2 ай бұрын
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.
@Cmanorange
@Cmanorange 2 ай бұрын
26:10 raysan appreciation post
@John-yg1cq
@John-yg1cq 2 ай бұрын
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?
@MrMeltdown
@MrMeltdown Ай бұрын
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_ 2 ай бұрын
why not set the functions pointers again on hot reload? I mean, u already rebuild the vtable on hot reload
@markmckenzie5343
@markmckenzie5343 2 ай бұрын
44:18 the way you said "pure" lmao
@misisumegi6138
@misisumegi6138 2 ай бұрын
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
@maxpoulin64
@maxpoulin64 2 ай бұрын
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 Ай бұрын
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/
@TheJanhalsema1
@TheJanhalsema1 2 ай бұрын
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.
@me_12-vw1vi
@me_12-vw1vi 2 ай бұрын
i agree
@StevenMartinGuitar
@StevenMartinGuitar 2 ай бұрын
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.
@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
@saidwho9891
@saidwho9891 2 ай бұрын
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.
@saidwho9891
@saidwho9891 2 ай бұрын
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
@babenoff
@babenoff 2 ай бұрын
Daesh horoshii uchebny jazyk😮
@danopamine
@danopamine 2 ай бұрын
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
@Argoon1981
@Argoon1981 2 ай бұрын
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 2 ай бұрын
Yes
@pemrograman-cepat3393
@pemrograman-cepat3393 Ай бұрын
Wow. Your title is always legit 😮
@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.
@antonpieper
@antonpieper 2 ай бұрын
`override` implies `virtual`, so you only need to put `override` on member functions in child classes
@Argoon1981
@Argoon1981 2 ай бұрын
override keyword, is not available in older c++ code bases, it exists only since c++11.
@antonpieper
@antonpieper 2 ай бұрын
@@Argoon1981 you should be using C++11 or newer
@Argoon1981
@Argoon1981 2 ай бұрын
@@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.
@mrmaniac9905
@mrmaniac9905 2 ай бұрын
that title made me have an audible gasp. you scared me tsoding, you scared me.
@nyyakko
@nyyakko 2 ай бұрын
POG
@ApolloJet86
@ApolloJet86 Ай бұрын
Could somebody please explain to me what has happened from 13:03 to 13:18 like I'm five? It sounds interesting.
@xavierthomas1980
@xavierthomas1980 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
@@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 2 ай бұрын
@@rusi6219 did you actually read what I was saying or did you just want to be angry at someone?
@Henry-sv3wv
@Henry-sv3wv 2 ай бұрын
why use unsafe c++ if we now have a safe rust
@alanwest6949
@alanwest6949 2 ай бұрын
Yes.
@alexpyattaev
@alexpyattaev 2 ай бұрын
Clangd LSP is quite good with c++ too
@trwn87
@trwn87 2 ай бұрын
C is cool because it's challenging. 😎
@rubyciide5542
@rubyciide5542 2 ай бұрын
Yeah right manually flipping bits inside a flipflop is easier so its trash
@depralexcrimson
@depralexcrimson 2 ай бұрын
@@rubyciide5542 manually sending electrical inputs through a baseboard is way more challenging so that is trash too.
@DiegoSita
@DiegoSita 2 ай бұрын
​@@depralexcrimsonmanaging the velocity and directions of every single electron on a circuit is way more challenging so this is also trash
@Argoon1981
@Argoon1981 2 ай бұрын
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 2 ай бұрын
@@rubyciide5542 U talking about a floppy diks ???
@msxmlable
@msxmlable 2 ай бұрын
re-implement a poor man's COM, love it :)
@justaszakarauskas6068
@justaszakarauskas6068 29 күн бұрын
C is GOD in the embedded world.
@TechTutor429
@TechTutor429 Ай бұрын
Great
@ominusliticus8264
@ominusliticus8264 2 ай бұрын
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`
@FDominicus
@FDominicus Ай бұрын
Maybe you like to make this session with D? Or Objektive -C?
@buriedbones-nh9xr
@buriedbones-nh9xr Ай бұрын
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
@Idiomeme_com
@Idiomeme_com 2 ай бұрын
Wow 1 hour
@redheavenhero7709
@redheavenhero7709 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
@@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 2 ай бұрын
@@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.
@origamitraveler7425
@origamitraveler7425 2 ай бұрын
based
@belst_
@belst_ 2 ай бұрын
Barney Starsoup is actually a genius
@HonsHon
@HonsHon 2 ай бұрын
Bourne Stopdrop
@ThomasLee-vs2gu
@ThomasLee-vs2gu 2 ай бұрын
@@HonsHon Bono Stopshop*
@dickheadrecs
@dickheadrecs 2 ай бұрын
@@ThomasLee-vs2gu Bong Supermarket*
@Phantom-lr6cs
@Phantom-lr6cs 2 ай бұрын
lol
@howdoiexitvim-sg2xl
@howdoiexitvim-sg2xl 2 ай бұрын
I didn't even notice until i read it like three times XD
@nordgaren2358
@nordgaren2358 2 ай бұрын
Oh no. Does he find out that vtables aren't FFI safe in this video?
@MrMeltdown
@MrMeltdown Ай бұрын
In the earliest c++ you could write to the this ptr when you wanted to do in place new….
@michaelmas9817
@michaelmas9817 2 ай бұрын
yeah yeah, Java is just a subset of JavaScript
@joseoncrack
@joseoncrack 2 ай бұрын
🤣
@p99chan99
@p99chan99 Ай бұрын
@aniketbisht2823
@aniketbisht2823 2 ай бұрын
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 2 ай бұрын
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 2 ай бұрын
@@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 2 ай бұрын
there's a `_Generic` macro for that 😉
@rusi6219
@rusi6219 2 ай бұрын
So basically you like that C++ does the actual work for you? How lazy is that
@dysfunc121
@dysfunc121 2 ай бұрын
@@rusi6219 Lazy can be good, efficient.
@halfsourlizard9319
@halfsourlizard9319 Ай бұрын
Petition to have Bjarne change his name to Barney Starsoup!?
@SimGunther
@SimGunther 2 ай бұрын
Can your C do constexpr like C++ can? I don't think so!
@FlanPoirot
@FlanPoirot 2 ай бұрын
C23 has constexpr, it's deliberately made more constrained than C++'s version tho
@patboy24
@patboy24 2 ай бұрын
⁠@@FlanPoirotwym more constrained?
@0xfadead
@0xfadead 2 ай бұрын
​@@patboy24 No compile-time crimes
@SimGunther
@SimGunther 2 ай бұрын
@@0xfadead Like what?
@rusi6219
@rusi6219 2 ай бұрын
Having more poorly-implemented features is somehow supposed to be a w?
@hughjass6928
@hughjass6928 2 ай бұрын
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).
@rssszz7208
@rssszz7208 2 ай бұрын
Am learning cpp hope it helps😅
@jhi-42
@jhi-42 2 ай бұрын
My first job was also C++ Qt. I try to forget it.
@RushFuture
@RushFuture 2 ай бұрын
What was wrong? I've using this tandem for 10+ years more or less successfully :D
@mwlulud2995
@mwlulud2995 2 ай бұрын
​@@RushFuture why not use electron JS😉?
@RushFuture
@RushFuture 2 ай бұрын
@@mwlulud2995 mbedded, low resources
@qqshutup7175
@qqshutup7175 2 ай бұрын
@@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 2 ай бұрын
Is writing GTK GUI in c that much nicer? ( GObject ) or do you use vala?
@friedrichmyers
@friedrichmyers 2 ай бұрын
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 2 ай бұрын
I add templates to all my functions to increase compile times by 1000%
@John-yg1cq
@John-yg1cq 2 ай бұрын
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 2 ай бұрын
@@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 2 ай бұрын
​@@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 2 ай бұрын
@@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. :^)
@RandomGeometryDashStuff
@RandomGeometryDashStuff 2 ай бұрын
31:31 will `(decltype((da)->items))` preprocess to `()`?
@TsodingDaily
@TsodingDaily 2 ай бұрын
Yeah, I already fixed that.
@levvayner4509
@levvayner4509 2 ай бұрын
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!
@epic_gamerXD12345
@epic_gamerXD12345 2 ай бұрын
No
@xxMKtooStronk__
@xxMKtooStronk__ Ай бұрын
So you need 1 hour and 46 minutes to say is c++ better than c. Can you just say yes or no?
@ZoraAlven
@ZoraAlven 2 ай бұрын
44:22
@Painple
@Painple 2 ай бұрын
I like C# more than C++. Nice video as always 👌
@OREYG
@OREYG 2 ай бұрын
Those languages are incomparible
@dutchdykefinger
@dutchdykefinger 2 ай бұрын
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
@me_12-vw1vi
@me_12-vw1vi 2 ай бұрын
@OREYG what makes you say that?
@Henry-sv3wv
@Henry-sv3wv 2 ай бұрын
they say vala is like c# but compiles to c and makes GObject GTK GUI programming more easy
@MG-yc6jr
@MG-yc6jr 2 ай бұрын
C++ is just a dlc of c
@Capewearer
@Capewearer 2 ай бұрын
More like Total Conversion.
@rusi6219
@rusi6219 2 ай бұрын
@@Capewearer it's to C what The Frontier is to Fallout
@Capewearer
@Capewearer 2 ай бұрын
@@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.
@cobbcoding
@cobbcoding 2 ай бұрын
C wins yet again
@user-nt1uf4gl1i
@user-nt1uf4gl1i 2 ай бұрын
почалось)
@dvillegas
@dvillegas 2 ай бұрын
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 2 ай бұрын
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.
@wlcrutch
@wlcrutch Ай бұрын
No.
@inferrna
@inferrna 2 ай бұрын
Qt, Новосибирск... А не 2Gis ли это?
@TsodingDaily
@TsodingDaily 2 ай бұрын
Нет, это был Новокузнецк. Но в 2gis я тоже чуть-чуть работал.
@potatomaaan1757
@potatomaaan1757 2 ай бұрын
1:23:43 X-Potato (only real Gs will get this reference)
@MrKevinontube
@MrKevinontube 2 ай бұрын
Script tcl Bebe has got your back.
@Guilty-vv7xl
@Guilty-vv7xl Ай бұрын
TCL is hell 😭
@kirillratkin1590
@kirillratkin1590 2 ай бұрын
Maybe Zig will save this World ;)
@vincentl7022
@vincentl7022 2 ай бұрын
I was looking for that comment thanks
@aniketbisht2823
@aniketbisht2823 2 ай бұрын
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.
@twsnake2011
@twsnake2011 29 күн бұрын
C++ is the best
@nobodyspecial1553
@nobodyspecial1553 2 ай бұрын
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 2 ай бұрын
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
@shrddr
@shrddr 2 ай бұрын
Barney Soursoup 🤔
@Phantom-lr6cs
@Phantom-lr6cs 2 ай бұрын
lol
@BobChess
@BobChess 2 ай бұрын
C++ can do C but C can't do C++
@dutchdykefinger
@dutchdykefinger 2 ай бұрын
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
@SeattleSpursFan1882
@SeattleSpursFan1882 2 ай бұрын
@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.
@RajVishwakarma-jt4kw
@RajVishwakarma-jt4kw 2 ай бұрын
What is his real name 🤔?
@SimGunther
@SimGunther 2 ай бұрын
Alexey based on his commit history
@cobbcoding
@cobbcoding 2 ай бұрын
zozin
@GillesLouisReneDeleuze
@GillesLouisReneDeleuze 2 ай бұрын
oh yes my favorite language zeep-zeep lus-lus
@oraz.
@oraz. 2 ай бұрын
C is more enjoyable. Objectively I dunno.
@Phantom-lr6cs
@Phantom-lr6cs 2 ай бұрын
c is more easy that's all and it's not complex as c++
@rusi6219
@rusi6219 2 ай бұрын
@@Phantom-lr6cs complex with bloat is bad, not good.
@0LoneTech
@0LoneTech 25 күн бұрын
@@Phantom-lr6cs Easy/not complex is good for C's goal; a language that can be ported to new computers so we don't have to start over writing the entire operating system. C++ is bloat incarnate by comparison, and the one feature it added that was of relevance for that goal was a more detailed memory model. C++ comes with two glaring issues: it's always messier to use C++ features than plain C, and the library maintainers obsessively rename things.
@rogo7330
@rogo7330 2 ай бұрын
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.
@patrickjdarrow
@patrickjdarrow 2 ай бұрын
Me watching this as a python script kiddie 👁️👄👁️🍼
@matrixnorm6672
@matrixnorm6672 2 ай бұрын
no
@Capewearer
@Capewearer 2 ай бұрын
...because it's MUCH better.
@nordgaren2358
@nordgaren2358 2 ай бұрын
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 2 ай бұрын
Well if you tried C you a) wouldn't have to imagine and b) find out that you're wrong
@nordgaren2358
@nordgaren2358 2 ай бұрын
@@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 2 ай бұрын
@@rusi6219 c and c++ is unsafe
@astkh4381
@astkh4381 Ай бұрын
React is better
@gagagero
@gagagero 2 ай бұрын
My dad is stronger than your dad.
@God-vl5tk
@God-vl5tk 2 ай бұрын
Not surprised by someone who says "Right" after every statement he makes.
@Nova32x
@Nova32x 2 ай бұрын
Is he wrong tho?
@RandomNoob1124
@RandomNoob1124 2 ай бұрын
Bruh corporate engineers spam right after every statement at work holy shit it’s like shadow clones 🤦🏾‍♂️
@MrOnePieceRuffy
@MrOnePieceRuffy 2 ай бұрын
Whats this Question? A good language has a string class. Case closed.
@danielmilyutin9914
@danielmilyutin9914 2 ай бұрын
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 Ай бұрын
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 Ай бұрын
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.
@LongLiveIsrael-c7y
@LongLiveIsrael-c7y 2 ай бұрын
Cpp= C+Class 😎
@nirajandata
@nirajandata 2 ай бұрын
sorry, this terminology was only valid upto c++98
@dutchdykefinger
@dutchdykefinger 2 ай бұрын
fuck classes i only care about the namespaces templates can be handy in a pinch too :D
@valizeth4073
@valizeth4073 2 ай бұрын
@@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.
@inferrna
@inferrna 2 ай бұрын
C beats Rust, C++ beats C, Rust beats C++
@heco.
@heco. 2 ай бұрын
so like rock paper scissor
@rusi6219
@rusi6219 2 ай бұрын
Actually Rust curls up into a corner and cries.
@arson5304
@arson5304 2 ай бұрын
​@@rusi6219 why
@rusi6219
@rusi6219 2 ай бұрын
@@arson5304 because of its atrocious userbase.
@huistelefoon5375
@huistelefoon5375 2 ай бұрын
​@@arson5304afaik Rust is barely used in enterprise software, and it is significantly higher level. the comparison of C, C++ vs Rust is questionable
@sigmawolf228
@sigmawolf228 2 ай бұрын
на сдинозавры пишут тыче бле
@debooger
@debooger 2 ай бұрын
c++ nuuuuuu you fell off lmao
@user-gh4lv2ub2j
@user-gh4lv2ub2j 2 ай бұрын
Sometimes?
@thsposito
@thsposito 2 ай бұрын
i was hooked, and than all this bs about scripting languages not being actual programming languages... too pendantic. bye
@FlanPoirot
@FlanPoirot 2 ай бұрын
u won't be missed
@ElPikacupacabra
@ElPikacupacabra 2 ай бұрын
He's joking. He programs in a bunch of languages, and makes the same sarcastic statements for all of them.
I tried React and it Ruined My Life
1:19:10
Tsoding Daily
Рет қаралды 119 М.
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 213 М.
KINDNESS ALWAYS COME BACK
00:59
dednahype
Рет қаралды 151 МЛН
The Ultimate Tier Programming Tier List | Prime Reacts
26:57
ThePrimeTime
Рет қаралды 353 М.
I Parsed 1 Billion Rows Of Text (It Sucked)
39:23
Theo - t3․gg
Рет қаралды 94 М.
Will Ada Replace C/C++?
44:57
Tsoding
Рет қаралды 87 М.
Simulating the Evolution of Rock, Paper, Scissors
15:00
Primer
Рет қаралды 725 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 382 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН
You don't need Generics in C
1:37:38
Tsoding Daily
Рет қаралды 58 М.
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 288 М.
Ok, I made C compiler in PHP (c.php Ep.01)
3:02:49
Tsoding Daily
Рет қаралды 117 М.
I Rewrote This Entire Main File // Code Review
16:08
The Cherno
Рет қаралды 137 М.
OZON РАЗБИЛИ 3 КОМПЬЮТЕРА
0:57
Кинг Комп Shorts
Рет қаралды 1,8 МЛН
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 6 МЛН
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 1,9 МЛН
Samsung Galaxy Unpacked July 2024: Official Replay
1:8:53
Samsung
Рет қаралды 23 МЛН
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 7 МЛН