V is a masterpiece, as a junior programmer that on the way to find signature language, i finally got it, i chose it
@AliAbdallah-xz8vv12 сағат бұрын
When the child class doesn't implement the said virtual function, does the the child have a vtable pointer that contains an entry that points to the function in the parent class or what happens exactly?
@MikeShah7 сағат бұрын
I don't know if it's standardized in C++, but yes, a __vtable pointer that maintain a pointer to the original parent classes function pointer would remain preserved.
@MennoDuursma-q9l12 сағат бұрын
Oh, seems i'm getting old @7:03 maybe it may have been Pascal right ;)
@MikeShah9 сағат бұрын
I believe it was still C, but I forget if Sylven said for sure. Delphi was winning against VB during that time for application development -- so there was lots of Pascal out in the world! See the interview here! kzbin.info/www/bejne/lZvLgYV7itJ7gJY
@MennoDuursma-q9l7 сағат бұрын
@@MikeShah Thanks man! I'll watch it. Worked a little with Erlang before. Pascal was "the language" schools used to teach before Java got popular. BOS was written in it, which ran just about all HIS (hospital information) sytems in the Netherlands. I never got into Delphi however a colleague wrote our ticketing system in it. VB was about as popular for applications as php is for websites today. Most of wat i did was just bash & C. Later some CFEngine i guess.
@Roibarkan12 сағат бұрын
Great talk. One note about iter_swap (especially ranges::iter_swap) is that it is its own customization point which allows algorithms to work with ‘proxy iterators’. This underpins things in the ranges library like ranges::sort(views::zip(last_names, first_names)). I learned a lot on this from Jacob Rice: kzbin.info/www/bejne/hmq7iX2rdr6bg7M
@VoidloniXaarii19 сағат бұрын
Thank you ! You're my absolute favorite c++ cppcon speaker! S. Parent is little compared to u!
@MikeShah18 сағат бұрын
Cheers, thank you for the kind words!
@VoidloniXaarii18 сағат бұрын
@@MikeShah no no, thank YOU for your very generous gfx inclined cross platform lessons oh great teacher !! 干杯
@liquidatedrice527423 сағат бұрын
SDL3 just released last night
@MikeShah21 сағат бұрын
Indeed! New SDL3 playlist is coming soon!
@m.onurcirit227Күн бұрын
I couldn't understand why the comparison between map and unordered_map given from the uniqueness perspective in the beginning of the video. Map also allows 1 entry per key AFAIK. What am I missing?
@MikeShah21 сағат бұрын
std::map is ordered, and std::unordered_map is not. The guarantees of the operations run-time thus are different (i.e. Log2(n) vs O(1) on average).
@m.onurcirit22720 сағат бұрын
@@MikeShah Thanks for the reply Mike, appreciate you!
@JeffarryLounderКүн бұрын
I have a packed address where two values within it (00130017) HAVE to be 4 apart by the millisecond - otherwise the program crashes. Do you know if I could use atomic to increment +3 to both of them and ensure they are updated at pretty much the exact same time? I am using 32bit, and the only way I can consistently ensure the program doesn't crash is if I'm running through the debugger step-by-step over it. It's very volatile and only works like 30% of the time otherwise.
@MikeShah21 сағат бұрын
It seems like you are wanting to add using bitwise operations on the top and bottom set of bits. The bitwise operations are atomic for integral types (en.cppreference.com/w/cpp/atomic/atomic). I suppose you could use a high resolution timer to see how fast they are. I'm curious what problem is this solving, or is this an interview question?
@twenty-fifth420Күн бұрын
D is in my top 2 I think for how a language describes a 'package'. So from what I understand, D packages are like swift packages in the sense they can be defined with source files. It actually reminds me of Odin, just with a bit more abstraction and control. In fact, I wonder how this feature will work with C FFI? Seemingly painless to link C and D together, I have done that before. But what if your package is mixed sources? Will Mike answer this for me? I guess I have to tune in!
@MikeShah21 сағат бұрын
Indeed! At some point I'll show more with extern(C) and how to interface with C (and even C++) libraries on this series :) It's pretty painless -- so many excellent quality of life features in D :)
@developer47-l5fКүн бұрын
I was building llvm on win10 + abi msvc22. As a result, lldb crashed on breakpoints. According to the dump, the problem is with python, but I have python10, which lldb needs. I don't know what else it needs..... on windows one pain :( lldb in windows doesn't support autocomplete in terminal....
@stupengamerКүн бұрын
One of the most important videos in the series!!
@sanjaygatne14242 күн бұрын
This is beauty of C++ syntax, language rules, most vexing parse and extra-terrestrial error massages 🤣makes seasoned programmer confused for such a trivial conversion code.
@MikeShahКүн бұрын
The principle of 'least surprise' is not always followed in C++ 😅
@AGI.ROBOTICS2 күн бұрын
Thanks sir, In future sir Can you create playlist about using c++ with Ros2 and thanks
@AGI.ROBOTICS2 күн бұрын
and yes we have C++26 , thanks sir :')
@MikeShah2 күн бұрын
Indeed, on the way!
@pschneider19682 күн бұрын
Awful video. You were totally unprepared and did not have any clue about any aspect of the things you wanted to present. Thank you for wasting my time.
@MikeShah2 күн бұрын
@@pschneider1968 I'm sorry you felt that way. The purpose of this series is indeed to look at a new environment for ~1 hour without any preparation. It's an honest livestream (almost a user study) for language and tool creators to see what it's like exploring something new.
@agustinpizarro2 күн бұрын
wow. I used Amiga E... 35 years later still in love with it, easy, compat binaries and productive ... thanks Wouter.
@MirrorsEdgeGamer013 күн бұрын
I also used packages when making my raytracer. A lot of my decisions were based on learning the language, even if it was a nonoptimal way to do it.
@MikeShah3 күн бұрын
@@MirrorsEdgeGamer01 Yes, always good to try the features in context of a project and then see where they best fit in solving problems.
@MirrorsEdgeGamer013 күн бұрын
@ Yeah, I agree. I love metaprogramming in general. I first heard about D again. I want to talk about the reflection API coming to C++.
@MirrorsEdgeGamer013 күн бұрын
Thank you for these videos. I am about to finish Raytraving in a weekend.
@MikeShah3 күн бұрын
@@MirrorsEdgeGamer01 awesome!
@RodrigoOliveira-cc3kc4 күн бұрын
Great video! Congrats!
@huiz.51074 күн бұрын
Hi Mike, it's amazing that you have such a clear and concise way to explain things! Thanks for all your time and effort you put here!
@MikeShah4 күн бұрын
@@huiz.5107 cheers, thank you for the kind words!
@zishankhan74065 күн бұрын
Please share the Playlist for modern C++ series
@MikeShah4 күн бұрын
Good news, you're right on it! kzbin.info/aero/PLvv0ScY6vfd8j-tlhYVPYgiIyXduu6m-L otherwise see courses.mshah.io for the same playlist
@Broadster5 күн бұрын
Thank you so much for this tutorial! Would you happen to have plans on a tutorial focused on serialization and deserialization?
@MikeShah3 күн бұрын
Cheers! I have some videos on serialization and deserializarion on my channel in the C++ series
@krut4rth5 күн бұрын
hi Mike, i am learning directx 12 in canada for game development subject....i am so interested now in this low level field...what should be my great aim as a graphics programmer? what should you build so u can get comfortable with it
@MikeShah4 күн бұрын
I think recreating effects from games and otherwise building small games is a good idea
@krut4rth4 күн бұрын
@@MikeShah thankyou mike, I'll give my 100 percent to learn direct X 12 and make those effects
@hitarthk5 күн бұрын
Teaching here is not that great. Would not recommend.
@theuniverse89485 күн бұрын
I am doing it no matter what it takes Graphics programming i take up this challenge of learning some ancient ruin computer language hope i will succeed in 2025
@machinelearning46116 күн бұрын
very well explained
@MikeShah5 күн бұрын
Cheers!
@daimonvenus6 күн бұрын
Thank you for your helpful video! I'd love to ask you a question. How do you see the career prospect as a graphics engineer ? I'm not from US but it seems like that it is a worldwide phenomenon that software engineering job market is getting collapsed. I got an internship in openGL pipeline optimization but still getting a bit worried about my future career.
@MikeShah5 күн бұрын
Sounds like you're on the right track. I've always felt roles in game (especially engine programming) and graphics programming translate well to basically any software role. Folks know these are challenging positions and graphics programmers have good skills, so I think lots of companies (especially in the semiconductor space) would want to scoop up folks with your skill set. Industry as a whole seems to be going through a big cycle though, so I cannot predict the future -- just keep challenging yourself to learn good skills.
@joeblandd64256 күн бұрын
Thank you for bringing more attention to Dlang! I've been toying with it for years and trying to convince people to give it a go, but I'm not in a position that many would listen to me. I'm curious as to what made you decide to start this series?
@MikeShah6 күн бұрын
@@joeblandd6425 Cheers! Programming in D has always felt like the right tool to get real engineering done. I am so productive in getting up a prototype when solving problems in D, that often times with D the right abstraction just emerges 🙂 D provides performance and it also has a good safety story -- I always encourage folks to give it a try 😁
@GaryChike6 күн бұрын
@
@bsdooby4 күн бұрын
What's that struct as globals "trick"? I mean, how would you use it? These are not static members, and an object must exist to get their values... This makes it semantically hard to grasp.
@GaryChike4 күн бұрын
@@bsdooby @MikeShah Hey Mike, could you verify if this GenAI bot response is accurate? Thx a bunch! 🤖 The comment refers to a practice mentioned in the video where Mike Shah suggests using a `struct` to group "globals" or variables in a module. The viewer's concern arises from the fact that in D, struct members are not inherently static, so accessing their values typically requires an instance of the struct. This approach might seem counterintuitive for managing global state or constants. ### **What the Viewer is Asking** The viewer is questioning the semantics of using a `struct` for "global" variables because: 1. **Non-static Members**: By default, a `struct` in D has instance members, meaning you need to create an object to access these values. 2. **Global Context Misalignment**: The term "global" suggests shared state accessible without creating instances, which aligns more naturally with `static` variables in a module or a class. ### **What Mike Shah Suggested** Mike Shah likely proposed this technique to encapsulate related "global-like" variables or constants under a common structure. This approach could help organize variables logically, but it doesn't make them true globals in the traditional sense unless they are explicitly made `static`. ### **Clarifying the Confusion** The confusion stems from the difference between: - **Instance members**: Require an object of the struct to access their values. - **Static members**: Belong to the type itself, accessible without creating an instance. If you define a `struct` like this: ```d struct Globals { int someValue; double anotherValue; } ``` You need to create an instance: ```d Globals globalsInstance; globalsInstance.someValue = 42; ``` However, if the intent is to have "global" variables, you'd need to use `static`: ```d struct Globals { static int someValue; static double anotherValue; } ``` Now you can access them as: ```d Globals.someValue = 42; ``` ### **Better Alternatives for "Global" State** Instead of using a `struct` with `static` members, D's module system provides a more natural way to define and organize globals: 1. **Direct Module-Level Variables**: ```d module myglobals; int someValue; double anotherValue; ``` Access them after importing the module: ```d import myglobals; someValue = 42; ``` 2. **Static Class or Struct**: If grouping is essential, you might prefer using a `static` class or a struct with static members for clarity: ```d struct Globals { static int someValue; static double anotherValue; } ``` ### **Why the Viewer Finds This "Hard to Grasp"** - The viewer likely finds it "semantically hard to grasp" because a `struct`'s primary use case is to define instances, not shared global state. - Using a `struct` without `static` for globals introduces unnecessary complexity, as you need to instantiate it to access its members. - The approach might mix two paradigms-structs for encapsulation and module-level variables for global state-which can lead to confusion. ### **Conclusion** The comment reflects the viewer's concern about the mismatch between the proposed technique and its apparent use case. While the struct-as-globals approach can work with `static` members, D’s module system is typically a more straightforward and semantically clear way to manage globals.
@bsdooby3 күн бұрын
@@GaryChike The bot summarizes and enhances my concerns pretty accurately. Still impressed what these LLMs are capable of. But let's wait for @MikeShah to respond on my initial, not AI enhanced question. This is to keep humans in the loop...
@RahulBochare-z5m6 күн бұрын
learned alot, Thanks Mike.
@MikeShah6 күн бұрын
Cheers!
@philtoa3347 күн бұрын
Happy new year 👍
@MikeShah6 күн бұрын
Happy New Year!
@aaabbb-gu5pz7 күн бұрын
VisualD installation brokes Visual Studio, so I rejected the D lang entirely.
@androth15026 күн бұрын
microsoft broke visual studio. use vscode.
@MikeShah6 күн бұрын
Have you tried recently? VisualD is not a prerequisite for the language. Many folks otherwise use VS Code with the code-d plugin for completion
@GaryChike6 күн бұрын
@@MikeShah I rarely if ever use Visual Studio for Dlang myself. Because I'm platform agnostic, it's a pleasure working in VS Code (or VS Codium) with the "D Programming Language (code-d)" extension.
@MikeShah6 күн бұрын
@@GaryChike I've heard a lot of the game dev folks like visual studio, and that's what I used in industry, but I like living in VIM and having no need for an IDE as well 🙂
@GaryChike6 күн бұрын
🎶"Came for the low" (ZHU, partywithray) - low level that it is!
@bsdooby7 күн бұрын
Could there be a use case to have a package.d file (similar to `module-info.java`) privately export its members (files, submodules)?
@MikeShah6 күн бұрын
I'm not super familiar with module-info, but indeed I could imagine a private function that logged using traits what modules are being used.
@bsdooby6 күн бұрын
@@MikeShah Ah yes, that would be a feature ;) let me test this ...
@Br4dButt0wski7 күн бұрын
Question: how suitable would Nim be for game or graphics stuff?
@MikeShah7 күн бұрын
I suspect it's perfectly fine
@shanemcleod55007 күн бұрын
Question. At the end of the video, talking about using move semantics with unique pointers. After transferring ownership of the UDT class in your example from `mike` to `joe`, does `mike` become a "dangling unique pointer" until the end of the local scope?
@MikeShah7 күн бұрын
Indeed, mike is 'nullptr' . So you'll have to check against null (or otherwise if(mike.get()==nullptr){ // handle case... }) before accessing the pointer in that scope.
@shanemcleod55006 күн бұрын
@@MikeShah Excellent! Thanks!
@MikeShah6 күн бұрын
@@shanemcleod5500 Cheers!
@mytech67797 күн бұрын
YT deleted my comment. I don't think their broken censorship algo likes code snippets or any technical-scientific posts for some moronic reason. (but I know breaking it into multiple replies is a workaround.)
@mytech67797 күн бұрын
I can see swapping single elements in arrays being handy, I'm glad you included that example because I can't think of a single case where using std::swap on whole objects would have any logically functional purpose. Maybe as a work around to wire together some terrible spaghetti code strewn across multiple files with excess macros, defines, and use of extern/static? In fresh code, using std::swap version has at best more compile time overhead as the optimizer figures out that the remainder of the file is simply opposite-day and removes all the swapping internally (Essentially converting it into version one.), and I suppose the worst case it will do an an actual runtime swap in memory. E even if it is only swapping memory addresses using spare registers, it's two reads and two writes. As non-hot-path code an address swap is a trivial inefficiency, but the point is that it is any non-zero work for absolutely no change to the result.
@mytech67797 күн бұрын
//some basic operators removed to workaround YT hashtags, angle brackets and some curly braces. Hashtags seem esp problematic. Just tested with godbolt. GCC 14 in -O0 does indeed add the 4 instructions for swapping addresses, and -O1[+] produces identical assembly down to the letter. …include iostream …include utility void myfunc(long A) long fu {4l} ; long bar {5l} ; /*... non-swapping version*/ fu *= A ; bar += -A ; std::cout << bar << std::endl; } /*... end v1*/ /**... swapping version **/ std::swap(fu,bar) ; bar *= A ; fu += -A ; std::cout << fu << std::endl; } /**...end v2**/ int main(){ myfunc(3l); return 0
@mytech67797 күн бұрын
//basic operators removed to workaround YT. hashtags, angle brackets and curly braces and semicolons also changed multiply to "×" and old style initialize/assignment. Hashtags seem esp problematic. Just tested with godbolt. GCC 14 in -O0 does indeed add the 4 instructions for swapping addresses, and -O1[+] produces identical assembly down to the letter. include iostream include utility void myfunc(long A) long fu = 4l long bar = 5l /*... non-swapping version*/ fu = fu × A bar = bar - A std::cout << bar << std::endl /*... end v1*/ /**... swapping version **/ std::swap(fu,bar) bar = bar × A fu = fu - A std::cout << fu << std::endl /**...end v2**/ int main() myfunc(3l) return 0
@mytech67797 күн бұрын
So my second reply is still there but hidden unless you sort comments by newest. So frustrating.
@Ashishkenduar7 күн бұрын
I am from India
@MikeShah7 күн бұрын
Welcome!
@eduardabramovich12168 күн бұрын
Is Java a good option to learn and then introduce myself to games and graphics dev?
@MikeShah8 күн бұрын
Perfectly fine to learn a programming language and then dive into graphics -- I'd recommend doing a few simple projects (e.g. build a small card game, tetris, etc.) and then come back and visit OpenGL. From Java the OpenGL function calls and API will effectively be the same.
@eduardabramovich12167 күн бұрын
@@MikeShah Thanks a lot for your response. As I was searching for learning resources, I found also a huge amount of content to learn physics and gamedev with JS. I have some intermediate experience with the language. How good it would be to learn with JS and then move to C# or C++ (which seem to be much more used in graphics and games thatn Java?
@MikeShah7 күн бұрын
@@eduardabramovich1216 I think hitting the ground running using any language (e.g. JS with something like three.js) would be great. You can always transition or change languages later, but it's important to otherwise learn the concepts, and otherwise get some practice and exposure to the idea of graphics/game programming.
@eduardabramovich12167 күн бұрын
@@MikeShah thanks a lot Mike!
@panicse8 күн бұрын
Thanks Mike, For example if we would like to swap last five elements in two lists. The best option will be to use iter_swap inside for?
@MikeShah8 күн бұрын
That's probably right. I suspect there's an overload for std::list and std::forward_list but I cannot look at the moment.
@mytech67797 күн бұрын
Maybe you could use std::swap on those within a range based for? Ah! I just found std::swap_ranges and std::ranges::swap
@RahulBochare-z5m8 күн бұрын
Really enjoying STL series Mike ,Thanks. Have some questions like -- In terms of memory perspective, where is unordered/set set stored? And is it stored contagious memory?
@MikeShah8 күн бұрын
Would need to look at implementation but cppreference states: "Internally, the elements are not sorted in any particular order, but organized into buckets." en.cppreference.com/w/cpp/container/unordered_set -- so that sounds like a contiguous table that can be resized and reshashed on once load_factor exceeds some threshold.
@pawekwasny71089 күн бұрын
Ok, sticking to the mesh example - if we use mesh as an intrinsic data then we cannot modify it - meaning it cannot move. How would you deal with that?
@MikeShah8 күн бұрын
In graphics we have a separate (extrinsic) 'transform' that transforms each vertex. So locally the geometry of an object (e.g. a box with dimensions 1m x 1m x 1m), but we can 'move' or 'transform each point'. Thus the savings is in not having to duplicate the geometry, and only store a transform (e.g. a vector of floats telling us to move each vertex 1m in the x dimension, 2m in the y dimension, 3m in the z dimension).
@bsdooby9 күн бұрын
The one feature of D that I do not really get ;) I miss namespaces in D.
@MikeShah8 күн бұрын
Coming from C++ I initially missed namespaces. However, as soon as I started reading other peoples code (e.g. various dub libraries), I really liked the structure that packages provided.
@sulabhhoon9 күн бұрын
good video , but mutex and binary semaphore are same ?
@MikeShah8 күн бұрын
I should have been more specific -- they are similar, and you can use a binary semaphore in a 'mutex-like fashion to guard a resource' but the mechanism of a 'lock' (mutex) and a signal (a binary semaphore that increments/decrements) are indeed different :)
@aceman90309 күн бұрын
Bro this is a fucking goldmine thanks
@MikeShah9 күн бұрын
Cheers, enjoy!
@gx_devansh2039 күн бұрын
what do you think about - Computer Graphics : practice and principle , i know it is an outdated book . but i have only heard good things about it
@MikeShah9 күн бұрын
There are some more recent editions and it's worth reading. I'd read an applied book alongside it if you're just starting, but the more math-y books will start to make sense why the graphics apis are as they are 🙂
@GaryChike9 күн бұрын
Good things come in threes! thank you for continuing to create superb D tutorials!
@MikeShah9 күн бұрын
Absolutely -- thank you for your support Gary! Let us know what you're coding these days otherwise!
@GaryChike8 күн бұрын
@@MikeShah I still reside in tutorial hell ❤🔥but I'm luvin' it
@MikeShah8 күн бұрын
@@GaryChike Not a bad place to be -- I'm right next to you writing more tutorials as we speak 😄
@ninthcrusade48719 күн бұрын
Can you in fact use the CPU for Input, Sound, Game Mechanics like collisions, and basically use the rendering pipeline with the use of shader programs and do all the graphics exclusively on the GPU and have virtually no graphics handling on the CPU? In other words data is piped to the GPU but the GPU, through uniform variables, does all of the drawing. I am not making myself very clear, but I hope you get the gist of what I am saying.
@MikeShah9 күн бұрын
That is indeed the idea to split the work between CPU and GPU for what each are good at :)
@ניריבןלולו9 күн бұрын
I find it really confusing how opengl (or the driver) knows which program / VBO / VAO are currently active, this all looks like a huge global state which is really weird if you consider any real world GUI frameworks. it can't possibly be that the whole GUI uses just one pipeline. or am I wrong?
@ניריבןלולו9 күн бұрын
someone on discoed noted that the current gl context is a per thread global that you usually init just once per app runtime. and you'd typically have just one rendering thread.
@MikeShah9 күн бұрын
@@ניריבןלולו Indeed, that is correct. This is one of the things that Vulkan tries to improve upon in regards to the concurrency aspect. That said, usually only one rendering thread is used anyways (or at least historically has been true).
@VoidloniXaarii9 күн бұрын
Thank you so much again!
@MikeShah9 күн бұрын
You are most welcome!
@mworld9 күн бұрын
Rendering is outside of the entity managers scope.
@MikeShah9 күн бұрын
That's fair -- in a larger project this should be divided into further systems.