Thanks to watching! You can send your code to chernoreview@gmail.com for review, and don’t forget that the first 1000 people to use the link will get a free trial of Skillshare Premium Membership: skl.sh/thecherno12201
@RoshanPradhan24 жыл бұрын
The login didn't work and I came when there were 380 viewers 😞
@electroGoal4 жыл бұрын
Did you have any experience with device driver. If yes please make series with deep diving. And yes I love you C++ series also.
@Exodus-bu6gu4 жыл бұрын
Hello! Do you also accept Java Swing based project? I've got a small framework with 2 games in it (Pong and Brick Breaker). Yeah.. Java does the Rendering part, there are still over 20 classes though.
@drkmgoswami30424 жыл бұрын
Please tell how to make game engine in C
@Pandino824 жыл бұрын
The commit 'remove swear words' is fantastic.
@TheRealMangoDev15 күн бұрын
fucking hell- oh wait
@MinhLe-lc7tk4 жыл бұрын
"Hey what's up guys, my name is The Cherno" is my morning alarm ringtone
@ShivamJha004 жыл бұрын
Pretty weird but ok
@rickarmbruster87884 жыл бұрын
@@ShivamJha00 pretty weird but u know what u have todo in the morning :D
@techquire4 жыл бұрын
@@rickarmbruster8788 wake up?
@Moonlight-pk2st4 жыл бұрын
@@techquire You, good sir, gave me a nice laugh
@angela_jx4 жыл бұрын
“I love documentation” and “I wonder what this function does” is very relatable to someone who’s written excessive amounts of jsdoc lol
@harikrishnanb.a.6284 жыл бұрын
Thanks Cherno for reviewing code by others. It really helps coders like me, who are still in track of learning C++ .
@Gornius4 жыл бұрын
9:04 - I am studying CS at not at all prestigious university and they explained to us on like every course what self-documenting code is and what the point of comments is. You would get minus points for code readability for these kinds of comments as well as minus points for variables like "a, b, c, x, y, z (..)" unless they're like obvious iterators. I mean it's common sense too. After a while of coding you develop these habits yourself.
@zombi1034 Жыл бұрын
At our university programming assignments regularly had requirements like „every method needs to have a doc string“ Funnily, these assignments were graded automatically and you would get full points for just an empty doc string above the method signature😂😂
@JavedAlam-ce4mu6 ай бұрын
@@zombi1034 The google C++ guide says every class needs a comment explaining what it is
@ddanielsandberg4 жыл бұрын
"C++ is getting a little bit messy." Getting?
@TheVertical924 жыл бұрын
🤣 i thought the same^^
@Waffle45694 жыл бұрын
9:11 self descriptive code is really underappreciated, I can't tell you how much code I've had to sift through with "no shit" comments that eat up time and space.
@Nick-lx4fo4 жыл бұрын
No shit.
@matthewe38133 жыл бұрын
@@Nick-lx4fo No shit.
@LPFan333 жыл бұрын
// This is my youtube comment where I explain I agree with you about unnecessary comments in code that add no value whatsoever. Instead they just clutter the code and induce face palm syndrome. I agree. Comments in code that add no value whatsoever just clutter the code and induce face palm syndrome. But I think in this case the guy might have had a teacher that tells the students to put comments on every function.
@matthewe38133 жыл бұрын
@@LPFan33 breaker of the "no shit" chain
@LPFan333 жыл бұрын
@@matthewe3813 no shit
@Blind564 жыл бұрын
21:09 it's probably written this way because you multiply two floats and then multiply with vector, basically one float-float multiplication and one vec-float multiplication. the other way around (the logical way you suggested) it would do two vec-float multiplication. basically it's a minor optimization a better way to write it , i think would be delta * speed * direction
@bakedbeings4 жыл бұрын
One uni teacher here (can’t speak for everyone): when I’m assessing the commenting and formatting I give out fewer marks for submissions with redundant comments and I explain why. It creates a bad signal to noise ratio like you said, plus the extra scrolling - the less code you have on screen due to loads of comments, the higher the strain on working memory, and the harder it is to see the entirety of functions/loops/conditionals. We teach it that way too.
@bakedbeings4 жыл бұрын
Re the complexity: there are serious skills on display, buuut it does feel like starting a catering business one morning to have some beans on toast. It’s fine but there’s a big opportunity cost. That time and brain juice spent on flexibility and expandability isn’t going towards great feel in the controls, physics, player feedback. Maybe they created frameworks in a previous life?
@spudacus20594 жыл бұрын
I would love to see you a code review of the Unreal engine.
@badwolf81124 жыл бұрын
i bet thats the length of the lord of the rings book series a few times
@typicalretard69684 жыл бұрын
Unreal engine isn't open source, so it's source code isn't available to anyone apart from its developers in Epic Games
@askeladden4504 жыл бұрын
@@typicalretard6968 No, it isn't open source but its source code is freely available to anyone on Github (You have to create an EpicGames account). I actually use it as a kind of reference/inspiration when developing my game engine.
@mattiapezzano17134 жыл бұрын
@@typicalretard6968 download the engine, you have the source.
@lolpop77994 жыл бұрын
@@mattiapezzano1713 have fun reverse engineering the whole engine
@notgrinch4 жыл бұрын
I know you're following your passion and glad that you have people to support you. I've been a regular watcher of your C++ series. Yea it's one of the (if not the) best on KZbin. Watching your opengl ones. But I feel like the channel is headed in a different direction from where it started. Those raw tutorials which were the regular content are now becoming rarer by the day. Probably it's for the best & probably it's just me being nostalgic but I do miss those old content.
@AgentM1244 жыл бұрын
He has his code reviewed by Cherno so he gets a perfect grade handing it in to his professor. XD
@The88Cheat4 жыл бұрын
"-5 Not enough comments."
@walkieer4 жыл бұрын
Wish more people did this type of content for other languages and project types.
@sacredgeometry3 жыл бұрын
Its pretty much an industry standard technique. Get a job and you will get your code reviewed all the time.
@adamrushford Жыл бұрын
Just fucking program.... are you trying to learn languages? try using the languages the languages are written in, most are C or C++... so then read what it does and you will know how to change a tire because you've worked for a tire manufacturer..... EVERY SINGLE SUCCESSFUL PROGRAMMER DOES SHIT THAT WAY.... all the C++ devs anyway... the rest of you are scripters LOL!
@offchan4 жыл бұрын
21:40 actually any grouping makes sense. you can think of moveSpeed * delta as figuring out the distance to move as well. moveSpeed is m/s and delta is seconds so if you multiply them you get meters.
@Girugi4 жыл бұрын
And (scalar * scalar) * vector, is less operations than (vector*scalar) *scalar. And even if it does feel more logical to apply dt last, it's not that strange as it was. So in that case performance should take priority imo.
@jurchiks4 жыл бұрын
@@Girugi do you REALLY care about performance that much in Pong?
@Girugi4 жыл бұрын
@@jurchiks it's not about pong. It's about a principle to not leave performance on the table when it's this simple. It should always be a consideration of what order to do operations. It gets automatic in your head if you do it, and if done all over a big project it makes a difference. If it just was written in an suboptimal way I would not have said anything, but for churno to talk about it and teach everyone to do it suboptimal is enough to warrant a few comments.
@jurchiks4 жыл бұрын
@@Girugi Too bad the compiler doesn't optimize this. Or does it?
@Girugi4 жыл бұрын
@@jurchiks yeah, that is unfortunate that it can't do that. As floating point values has precision issues, changing the order without knowing the numbers can give different results. Same for int, due to potential overflow and such.
@elirannissani9144 жыл бұрын
I'm happy you started to upload again :)
@ABaumstumpf3 жыл бұрын
For 20:55 the movepspeed-delta thingy: "i move this far (speed*time) in that direction" - is imo better - Speed*time gives us the distance, and then we set it to the correct direction. "i move this much, i actually only need to move this much" seems way more counterintuitive, and the "direction*speed" gives us a directional speed, and then we decide how far to move. The compiler likely will turn both into similar assembly, but with multiplying the vector first, if the compiler really does that, you would also have more operations.
@MikeLeed4 жыл бұрын
"Just stomp the ball with a fresh ball" 16:10
@mikaay42692 жыл бұрын
Cherno when you allocate 1MB on the stack: **I sleep** Cherno when you compare a string with length 4: **real shit???**
@ohhkennny7664 жыл бұрын
Thank you i’ve been learning to code in c++ from your tutorials and other sources for awhile now I’m still far from perfect but I always look forward to your videos as they’ve helped me a lot great coding teacher. 👍
@mrcjproject4 жыл бұрын
great code, love it. But the coder is struggling with c vs c++.
@adamrushford Жыл бұрын
10:20 it's called a hash table.. it's not always memory addresses, a lookup table is perhaps the correct term.
@pedroduran89273 жыл бұрын
Your keyboard sounds sooo good :D
@EchoVids2u4 жыл бұрын
Looking at this I feel like I am looking at a completely different language
@sirfranciscanadianbacon14683 жыл бұрын
Glad I’m not the only one
@andreyprotsenko98554 жыл бұрын
I bet the project was written with clion, which sometimes gives pretty arguable suggestions.
@TheXeropax4 жыл бұрын
I really liked how you weren't roasting him only corrected his code, how would you do it instead of 'this' or 'that'. This is pure educational. Well Done :).
@danchovanes26124 жыл бұрын
For students: the name of the function should explain what it's doing, your comments should explain why the function is needed. For devs: there are no comments and the Jira story description is full of acronyms.
@LPFan333 жыл бұрын
Function is an interface. The interface cannot assume who the client is and why it is needed. It should only make a clear promise about what it does. Different clients may call it for different reasons.
@plavagames5056 Жыл бұрын
FYI at 3:32 if you are like me and are wondering: the shortcut to switch the focus to the address bar is CNTR+L I had to pause the video and google it because I wanted to know.
@totallynuts75954 жыл бұрын
I'm a first year electronics and telecommunications and we've been doing introductory-level C. Yes, not everyone in the uni had programming classes before, but holy fuck the progress is slow and only a few of my colleagues are actually interested in programming. Along with online only courses caused by the *unspecified virus of unknown origin*, it's been a frustrating experience, to say the least.
@eduardopupucon3 жыл бұрын
"an idiot admires complexity, while a genius admires simplicity"
@elllieeeeeeeeeeeeeeeeeeeeeeeee3 жыл бұрын
its always harder to make something as simple as possible while keeping the functionality rather than making it as complicated as possible
@ishdx93743 жыл бұрын
@@elllieeeeeeeeeeeeeeeeeeeeeeeee well, simple isnt same thing as basic, if you want to keep it simple, unix developers once came up with "worse is better approach" where you just hack a thing in to add a certain feature, that sounds bad, but it really isn't
@eduardopupucon3 жыл бұрын
@@elllieeeeeeeeeeeeeeeeeeeeeeeee dude someone could have literally made something like this with 100 lines in a main.cpp file, this is absurdly complex for a pong clone
@brianbruhhh51703 жыл бұрын
So glad you’re doing this series man. Been rocking wit you since I was in 8th mf grade bro😂 I’m a senior in college about to get my bachelors in CS thank you so much for all your videos man💯
@jonyjohan89584 жыл бұрын
i think it's time to take some courses in c++ ... keep it up i love your channel ❤️👍🏼
@relytheone8534 жыл бұрын
Take the course, man!
@eonstar4 жыл бұрын
It's weird to find code from a student so clean, I find if I'm ever helping a classmate with something it's so hard figure out what they are doing (and it's seldom commented or we variables well named)
@thepurplepanda43 жыл бұрын
Most students of anything don't care until they have to. C's get degrees and whatnot.
@MegaRandompoo4 жыл бұрын
This code is overly confusing for what it is
@carsonholloway4 жыл бұрын
I agree: I made pong in C and it took about 2 days and I was left with about 250 lines of code across 2 files.
@Tetsujinfr4 жыл бұрын
Yeah but I think here the point was to show clear and well structured code, so that this is more of a scalable canvas for a larger project than the ideal one for this game as an end product. I think the author demonstrated capability to scale up code base big time here
@DrCrowie3 жыл бұрын
21:00 Actually the brackets do nothing in this expression because its all multiplication which is commutative ie. a*b*c == (a*b)*c == a*(b*c) but in terms of expressing an idea yea you're right
@Postermaestro2 жыл бұрын
The brackets will decide which order the variables are multiplied in, which can matter for implicit type conversion reasons. For example, if one of the variables was an integer, the order of operations could impact the result. Not that it might be a great way to write code that way. And as someone pointed out, the way it is written currently since moveDirection is a vector, there will be a float*float operation followed by a vector*float operation, rather than a vector*float operation followed by another vector*float operation. Now likely the compiler will find a way to optimize this particular instance to make them equal. But just in general, it's not safe to assume that just because something works out the same mathematically, it will do it the same way computationally.
@ratman5052 жыл бұрын
~21:35 - If I told myself from like 5 years ago that I'd some day be watching two people disagreeing on where to put parenthesis in a pure multiplication, I'd probably have slapped myself
@pako_powr4 жыл бұрын
Aaaand the understatement of the decade award goes to ... 5:54 !
@SETHthegodofchaos4 жыл бұрын
cant wait to see how Jonathans Blow Jai language will compare.
@adamrushford Жыл бұрын
if you wrap it in a macro Tav you can compile it as a DLL... external dependency and have pong in any game... only problem with his macro is that it isn't defined that way and if you really wanted it for that purpose you should have a generic resolution built into it, so you can place it in an arcade machine or have it adapt to the screen size just like the main game.
@newss56704 жыл бұрын
I’m 20 and no game engine yet.
@srijanpaul4 жыл бұрын
Oh same 19 and no engine, will society even accept us?
@elektra815164 жыл бұрын
I'm 22 and I haven't made one yet. It's an arduous process and takes a long time so don't expect to make Unreal in a week. Just take your time and be patient.
@whykekesneaky23104 жыл бұрын
I'm 28 and have been re-writing my game engines since my late teens. I may never have a game engine haha
@cankarkadev92814 жыл бұрын
@@whykekesneaky2310 I'm 19 and I am slowly getting choked by my own engine's increasing complexity XD
@potatoxel78004 жыл бұрын
im between 18 and 22 and i made a bad multiplayer game engine c:
4 жыл бұрын
can you please tell us which keyboard you are using , the typing sound great
@Bonfra044 жыл бұрын
is a mixture of assembly and C a well accepted codebase for a review?
@carsonholloway4 жыл бұрын
I would get behind that
@jawad97574 жыл бұрын
Sounds interesting
@felipegomes63122 жыл бұрын
by a mixture you mean 10% assembly and 90% C or 50% each?
@omerbuga52442 жыл бұрын
This "I love documentation" just make me have second thoughts of how i document🤣🤣
@Cobinja2 жыл бұрын
I could imagine those assertion macros were inspired by GLib, the library on which e.g. GTK is based on. There, you have e.g. the macros g_return_if_fail(condition) and g_return_val_if_fail(condition, value)
@markyrocks693 жыл бұрын
I made a pong clone using the console awhile back. It wasn't perfect but worked pretty good.
@mazdakhng30134 жыл бұрын
loved the background music!!
4 жыл бұрын
I have graduated from university recently and the biggest projects are assignment 😥
@ItsSunnyMonster3 жыл бұрын
Me during this entire video: * pretending to understand everything *
@michioyukihyou14034 жыл бұрын
0:38 Oh.. Shit! 27 and not a single game engine, i definitely live wrong way 😱😏
@Spongman4 жыл бұрын
fading the color *and* the alpha results in an r^4 drop-off of intensity, which is why the ball looks wrong.
@synchronizx54594 жыл бұрын
This perfectly defined the gap between a student and a real developer. The coder should be praised for his neat style but the style is abused so bad. I think education in uniersity should be more real-work-oriented.
@deidyomega3 жыл бұрын
Yeah, I would be upset if one of my developers did a PR with that much in there... like Jesus, how much did I pay you to write a comment to say, "This init function inits the app". Self document where you can, comments where the "obvious answer" isn't the correct answer. Unless you are making a public api, and your comments get converted into the actual documentation
@lodgin4 жыл бұрын
Just to add to the self-documenting code thing… I've been told pretty explicitly by career programmer types who manage the open source projects I contribute for that I need to write my javadoc in excruciating detail, otherwise I generally get dressed down and the pull requests get delayed and so on and _ugh._ It's annoying so the self evident stuff is there, but I also include things like notes like why the function is even necessary. For example, I contribute to a lot of Spigot plugins and I added a basic API that checks whether a given block is a crop, and I was asked why this was necessary since you can just check if the block data inherits from Ageable, so I included a little note in the javadoc explaining how fire and ice inherit from Ageable, thus isn't a reliable way to determine whether something is a crop.
@beachedwhale4 жыл бұрын
Regarding the noexcept, outside of move constructor/assignment(if you are actually defining them) it's probably not going to help. When code is doing something high level based on is_nothrow_move_constructible_v like thing(std::vector).
@LS-cb7lg4 жыл бұрын
This is quite educating
@tedeusz834 жыл бұрын
Hi Cherno, I am working on something different, its a raycasting engine that using software rendering, the goal is to optimised it as much as I can, is it qualify to review?
@timtom30733 жыл бұрын
You mean something like Doom or Wolfenstein 3D, that's nice. I guess Cherno takes everything :D
@mobslicer15293 жыл бұрын
In one of my projects (on Windows, because Linux is simpler) I load internal functions from the process loader DLL that are used to further load other functions by manually parsing the PE header and export table of the DLL.
@DrZygote214 Жыл бұрын
@5:56 "a little bit messy..." C++ has been a spaghetti language from the very beginning. Splitting up header files from program files, and everything else to be backwards compatible with C, is already bad karma foreshadowing "messy". Syntax is a nightmare. Today the language has been totally borked to keep up with new features that someone seems to want but 95% of projects never use. C++, slow to type, fast to run. Rust was a nice idea but it doesn't appear to be gaining popularity.
@bur98714 жыл бұрын
All nice and good, but this is the code equivalent of the pretentious kid in middle school who reminds the teacher he forgot to assign homework
@demolitionist424 жыл бұрын
Lol
@coolbrotherf1274 жыл бұрын
I've been watching for a while, but I just realized that you say "the cherno" at the beginning. With the accent it just sounded like random syllables to be.
@sourandbitter30624 жыл бұрын
Very instructive
@dcisme55944 жыл бұрын
Fine, you're my little codechamp
@suprithvasishta3053 жыл бұрын
Thanks for this video. Watching this interesting code review I would really like you to make videos on design patterns :)
@issaissa9554 жыл бұрын
Amazing Video 👍🏻
@RandomGuyyy4 жыл бұрын
It'd be interesting to see someone submit a jumbo build ( one big compilation unit like handmade hero, AKA the Ubisoft style )for review. It's quite a polarizing code style, I'm not sure Cherno would approve of it.
@nextwave51644 жыл бұрын
been watching Casey for a couple years, some have preordered the final "game" but man, he's been working on lighting for a long time.. also he refactors so much code it's hard to keep up with.
@anoniminteki3 жыл бұрын
Guys help me, what is this theme name(in video) in visual Studio marketplace
@meanmole32124 жыл бұрын
10 minutes in and I can't take it. I can really see part of my young self here, learning C++ with passion and taking seriously every advice about how writing comments and doing things only certain way is sooo important. Once you follow these great advices like an idiot enough times, you start to grow mentally and question your life. Hold on guys, maybe the great advices about writing comments and unit tests for everything is not the best way to use my time even though the mighty professor said so in the university. Hold on guys, maybe the C++ language is not the greatest thing out there and it actually forces me to burn my brain with all of these mandatory boilerplate steps and pitfalls. Maybe I should actually start thinking on my own and see what works, what is worth the time and what makes sense, you know, like any sane person would normally do.
@systematicloop32154 жыл бұрын
What would you suggest?
@meanmole32124 жыл бұрын
@@systematicloop3215 For what exactly?
@dcisme55944 жыл бұрын
@@systematicloop3215 Python.
@timtom30733 жыл бұрын
@@systematicloop3215 C :D At least I write my game engine in C :D
@LPFan333 жыл бұрын
// this is my comment where I explain that I think unit tests are actually a good and undervalued practice but I do agree with your remark about annoying trivial comments that add no value whatsoever unit tests good comments bad
@thedoublehelix56613 жыл бұрын
21:04 I think either way is fine. Speed is in m/s while dt is in s so speed*dt is in m. The direction is unitless, so multiplying by it doesn't change anything.
@xred1344 жыл бұрын
hey , love your content, would you be down to doing a cmake tutorial series?
@timtom30733 жыл бұрын
yeah that would be cool. CMake seems pretty mean at times. I love its functionality but debugging is a nightmare for me :(
@bluefood20103 жыл бұрын
Neat code, good review, thank you! I learned a lot hearing your thoughts on this code base. One nit-pick that's arguably a style preference: I'd have asked the author to leave the GPU resource handles out of the `Ball` class entirely. I think it's generally a good habit wherever possible to avoid coupling render state with logical state - just like how "OnUpdate" and "OnRender" are separate concepts that should be thought of in isolation, I think `Ball` and `BallRenderable` (name?) should ideally be thought of as separate. For a small project like this it's definitely over-engineering to set up some elaborate resource store and scene graph, but it could be practice with a nice pattern to focus on attaching logical and render objects at render time only, e.g. `renderBall(Ball logicalBall, GLint ballVbo, GLint ballProgram)` instead of `ball.render()`
@felipegomes63122 жыл бұрын
5:18 there is too much code in his commentary
@Girugi4 жыл бұрын
Position += (moveDir*speed) *dt; Is more expensive than: Position += moveDir*(speed*dt) ; That is likely why it was written that way.
@jurchiks4 жыл бұрын
What kind of bullshit micro-optimization is that?
@Girugi4 жыл бұрын
@@jurchiks I see you commented on another thread here so a more elaborate answer here is not needed. Just FYI, I wrote that on my phone just as I was about to sleep, so, I'm sorry that it was a bit short and not explaining much.
@felipegomes63122 жыл бұрын
it should be written more verbose in cases like this.
@oxassert9552 жыл бұрын
At 17:55 I would recommend not to use "auto" too much. Just use the type if it's simple like int, float, some class etc. auto is useful for shortening overly verbose things like long_name::renderrer_iterator::abstract_iterator_type.
@gower19734 жыл бұрын
It’s like he’s deliberately avoided using the primary purpose of c++, OO principles with classes and there inherent benefits of constructors and member functions.
@carsonholloway4 жыл бұрын
@Borgilian then what's the alternative? That's all anyone teaches for good design principles like SOLID. I would be open to an alternative bc I do find the whole OO paradigm a bit messy but, ya know, what else do we have?
@den007trof4 жыл бұрын
@@carsonholloway ECS may be alternative (see entt video tutorials here).
@systematicloop32154 жыл бұрын
@Borgilian Handmade Hero, while it contains a great deal of valuable educational material, has an incredibly verbose and fragile codebase. Its approach to an alternative design paradigm is just as extreme as OOP. I am curious to know what difference a member function makes than a non-member function? Why is RAII not a good thing?
@carsonholloway4 жыл бұрын
@Borgilian That sounds like just switching to C. I have tried that before and found that it's a little bit more pain than it's worth, with the primary reason being that it's no good for unit testing, at which C++ excels. Edit: I do agree with what you're saying about having an efficient abstraction for the hardware you're on, and to that I would say that's exactly what procedural programming is. Although this starts to fall apart when you want to have abstract code, as a lot of the time you end up implementing the strategy design pattern, or something similar to it, which is a rip-off of virtual functions in C++. But the whole reason almost the entire games industry is using C++ (for better or worse) is that it tries to be a "zero-cost" abstraction. If you think switching to C (which barely bothers with abstraction in the first place) would be a better idea, the only concern I would have with that is how one could write efficient unit tests for it. As regards to setting all variables to public, I would be entirely open to that of it went for the fact that encapsulation is necessary if you want to be able to change an implementation of a library you're writing without having to change the interface. In C, this is achieved through opaque pointers, and in C++, this is achieved through protected/private members. For this, C++ is actually the more efficient of the two, as there is no need to use the heap. On the other hand, I do agree with you that RAII is stupid, and I have found that it tends to be a source of bugs, as there are entire LINES of code that are inserted implicitly. Again, I challenge you to find a better alternative, where we can write high-level code (a non-assembly language) that is efficient, unit-testable, and has enough encapsulation to be able to change an interface without having to change the implementation.
@carsonholloway4 жыл бұрын
@Borgilian Let me just clarify that I'm not a fan of OOP (actually quite the opposite), but I am yet to find a way to do what it does in C. I am well familiar with Eskil Steenburg, and I think what he does works for him and that's great, but testing is the only reason I can't seem to be able to use C in real-world applications. I think that procedures are the only logical way to abstract code ("objects" are a contrived solution to a non-problem), because all code, and people seem to be forgetting this, should _do something_, which is exactly what a procedure is in the first place. And I do agree with you that there is nothing wrong with objects, but it is problematic to make the way you write code centered around them, as then that's not "doing something". But having a way to abstract objects is also critical to not having to repeat code that should not be repeated. Say we wanted to write a procedure that found the minimum value in a data structure. Such a procedure should not have to be re-written for each and every new data structure created. This is where object abstraction is useful. If we define an object that has hasNext() and getNext() procedures, then such an algorithm would only have to be written once. Look, I would be sold on the whole C thing if I could figure out how to write tests effectively and abstractly. I've done my fair share of research on the topic, and have not yet found a solution that is as viable as dealing with the pain of C++. The best "solution"I've heard as of yet is to write tests FOR C CODE IN C++ which is even more stupid in practise than it sounds. If you would be able to suggest an alternative to this mess that gives the lightweight-ness if C with the testability of C++, I would be more than sold.
@NickEnchev4 жыл бұрын
Directly shutting down the application if init() fails makes sense if we're only talking about systems that only allocate memory. There may be other types of resources allocated/acquired during init that need to be explicitly cleaned up.
@20thCB3 жыл бұрын
Most OSes these days will free all resources during process termination, not just memory. No need to manually clean up before terminating.
@NickEnchev3 жыл бұрын
@@20thCB You should always clean up memory/resources/handles regardless of what you "assume" your OS or drivers will do. Vulkan for example will literally error out if you try to destroy device instances/terminate without cleaning up buffers, imageviews, descriptor sets etc.
@arnabgupta71584 жыл бұрын
The reset functions looked over done a bit too much for sure. As Cherno said creating new object is a better way. Then you need not keep resetting it every time.
@northhamptonshire4 жыл бұрын
TLDR; Ultimate example of over engineering
@adamrushford Жыл бұрын
His main C++ is in C Cherno... that's why you don't recognize it... I've written that before windows used to not handle references.... if you pass a program through the CLI like an EXE then that code become highly useful.... but in modern c and c++ it's not written that way and you would likely use a plugin lib instead.
@RoshanPradhan24 жыл бұрын
Cherno will you teach data structures in C++ please!!!
@LPFan333 жыл бұрын
struct Data { int x; }
@gmddolbaeb21912 жыл бұрын
@@LPFan33 based
@syth-14 жыл бұрын
Interesting with the delta - the way I've understood it before was this is the distance I'm moving, but this is the amount of time that has passed, and add that on to the base position,
@myvideosource663 жыл бұрын
It just hit me: how would you know if there is a virus you just run after build? How to check, without reading/understanding the whole code?
@not_herobrine37523 жыл бұрын
wonder what would it be like to write this in c++ 98
@hannessteffenhagen614 жыл бұрын
I prefer auto on the left side because the type names IMHO are mostly noise. Where not obvious you can still put the type to the right of the `=`. It's a stylistic choice sure, but I can't really agree that there's an obviously better one. auto isn't about typing less; Nobody needs help typing, we have IDEs to do completions. Also, again you don't use const to aid code generation. That's silly. Compilers can figure out whether or not something is (effectively) const in most cases where it'd affect code generation anyway. The reason we write const is because unfortunately C++ has everything be mutable by default and it's helpful to signal the difference between mutable and immutable variables somehow. If I'm seeing that something is *not* declared as const I'm expecting that to be an accumulator or otherwise mutated and I always have to do a double take if I see it's not actually used that way anywhere.
@20thCB3 жыл бұрын
When you are scanning code quickly, seeing that something is 'bool' is much more useful than 'auto'.
@barmelumad32294 жыл бұрын
In 21:30 this is not gonna matter. You can multiply the numbers by any order and the result will be the same.
@TheCherno4 жыл бұрын
Of course it doesn’t matter computationally, I’m talking about readability and _style_
@12kilzen4 жыл бұрын
@@TheCherno I assume movedirection is a vector3 or vector2. Your version is slower, because it does twice the "vector multiplication with a number". The original version, does only one "vector multiplication with a number" because first time it multiplies numbers and after the result with a vector.
@distant66063 жыл бұрын
nice job mate
@Kornchipzzz4 жыл бұрын
This is some amazing insight
@adamrushford Жыл бұрын
doxygen can take those comments and output a full manifesto on the classes, function names, etc... don't be too surprised by cloned comment/function names... that is also code actually.
@pulse58634 жыл бұрын
Please keep reviewing different codes ; i hope i'll be sending one asap.
@lee76944 жыл бұрын
I love these
@shivanshuraj71754 жыл бұрын
Can you have a discussion on Intel new iris xe gpu. is it good for OpenGl developers..or should I go with nvidia?in laptops.
@AndyChamberlainMusic4 жыл бұрын
you forgot the card at 18:36
@ferociousjuggler26684 жыл бұрын
Fairly normal
@DiZYRascal3 жыл бұрын
What keyboard do you use?
@madeso4 жыл бұрын
Not gonna lie, the code is not very good. You see a clean main. I see 3 function calls with no local variables macros and no return statements from a function returning int. I also see only global state. Why is everything global? Why are attributes replaced by macros? Why is every function documented but no macros are? noexcept is for when you use exceptions but want to make sure some parts doesn't use exceptions. If you don't use exceptions, just don't enable them. nodiscard however is pretty good though for finding bugs in your code. Great for finding when the following issues: std::stringstream stream; std::vector vector; //... stream.str(); vector.empty(); 5:40 both nodiscard and noexcept are not part of the 'data structures', also not sure why you suddenly go of on a tangent about "modern c++". Not sure what you mean by keywords for datastructures. I use struct. That is 1 less keyword than C and 2 less than your code.
@eonstar4 жыл бұрын
18:40 The Video for random wasn't linked
@devtube7344 жыл бұрын
Which keyboard you are using? thanks in advance
@navthenugget4 жыл бұрын
I guess it is a DAS Keyboard with Brown or Blue Switches
@devtube7344 жыл бұрын
@@navthenugget Thanks Brother
@mohammedjawahri57264 жыл бұрын
At 21:00, (moveDirection*movespeed) doesnt just make more sense but it is faster isn't it? You are letting the cpu pipeliner do a lot of moveDirection*movespeed which might not change whereas delta has a dependency
@Havii4 жыл бұрын
You should make C# tutorials
@10bokaj4 жыл бұрын
I disagree with you at 17:00-18:00, the parameters are not ball specific. What if you want more balls? then you would need to hardcode it into the ball class?
@xavierxeon4 жыл бұрын
The main function should not compile, because after "lepong::cleanup" no value is returned.
@nachiketagrawal51544 жыл бұрын
main function implicitly returns 0, not sure if standard says so but most Compilers will return 0 automatically
@jsnmad3 жыл бұрын
Those kind of comments are usually for the documentor but I get what your saying, the comments for me need to say more than the obvious. (that is for the reference documentation that will be generated from those type of comments)
@bubel404 жыл бұрын
i wonder if its safe to compile random code from github on your pc 🤔
@akashsinha13224 жыл бұрын
@@M______M he was referring to security.. if random code compiles into *.exe that spreads virus .. it will be an issue
@sacredgeometry3 жыл бұрын
It's so odd that most people either know how to write good comments or write self documenting code. It's increasingly rare to find people that can do both. Its either they write a declarative mess of nonsense and then explain the rationale in the comment or they write well separated code with clean names and then duplicate it in the comment above it.