Thank you for still doing this series this is basically the only tutorial about ms-dos besides the 8086 tutorials and those aren't about the operating system
Thanks, this is a great intro to pointers! It might be good to touch on pointer arithmetic in a future video, a concept that drives home the flexibility of this misunderstood data type.
It's surprising how far you can get into programming without really understanding pointers. I started programming when I was ten years old, worked my way up through Pascal and started with C, without ever really understanding pointers. I didn't learn how they really worked until college. Prior to that I just sort of knew that I needed "@" and "^" in certain places (at least I think it was "@" and "^" to reference and dereference pointers in Pascal--I don't remember for sure.)
Nice demonstration of how pointers work! Side note: you made a mistake declaring 'struct player'. struct's name must follow immediately after the 'struct' keyword. In this case you would get a compiler error at the line with: 'void draw ( struct player *p );' because there is no 'struct player'. You just have a variable 'player' allocated as said unnamed struct with it's attributes.
Yes, it was just a quick example I came up on the spot. I used to do something like this back in the day, to get rid of the need to write "struct foo" all the time: typedef struct _foo { ... } foo; This way you could use foo as the type instead of "struct _foo". That's why I made the mistake...
Nice video, very well explained😁 The only thing that I'm not sure is that you use the FP_SEG and FP_OFF on near pointers, and those macros might not give the result you want, given that the FP_ prefix of those macros stands for far pointer. Besides, you have shown that a near pointer has a size of 2 and contains only the offset, so where would FP_SEG get the segment information from?
I have to ask, does this version of Turbo C not support typedefs or was that an intentional avoidance so as not to muddy the waters for this discussion?
Of course it supports typedefs. And yes, I avoided it as not to introduce another concept. I also could have talked about output parameters and how they could be implemented using pointers… and so on…
@@root42 *nods* I couldn't remember how old typedefs were. I keep running into the issue of still thinking of C/C++ in terms of the '99 versions of the spec since that's when I was taught them formally, and it got me thinking about when the concepts I'm accustomed to just assuming are supported actually saw widespread acceptance.
Turbo C 2.0 is mostly ANSI C compatible. That changed very little until C99. The latter got a lot of the quality of life changes from C++98. Like mixed declarations and code and C++ style comments. Basically C++ without the OOP cruft. ;)
Thank you for still doing this series this is basically the only tutorial about ms-dos besides the 8086 tutorials and those aren't about the operating system
Thanks, this is a great intro to pointers! It might be good to touch on pointer arithmetic in a future video, a concept that drives home the flexibility of this misunderstood data type.
Yes good idea.
It's surprising how far you can get into programming without really understanding pointers. I started programming when I was ten years old, worked my way up through Pascal and started with C, without ever really understanding pointers. I didn't learn how they really worked until college. Prior to that I just sort of knew that I needed "@" and "^" in certain places (at least I think it was "@" and "^" to reference and dereference pointers in Pascal--I don't remember for sure.)
Especially nowdays with high-level languages like C#, Java or Javascript (but in C# you can chosse between byRef and byVal)
But even then there might be the requirement to interface with native libraries. And oftentimes that's when you can get in touch with pointers.
Thank you !
Cool !
Thank you for sharing your knowledge!
Really nice content, thx.
Thank you.
Nice demonstration of how pointers work!
Side note: you made a mistake declaring 'struct player'. struct's name must follow immediately after the 'struct' keyword. In this case you would get a compiler error at the line with:
'void draw ( struct player *p );'
because there is no 'struct player'. You just have a variable 'player' allocated as said unnamed struct with it's attributes.
Yes, it was just a quick example I came up on the spot. I used to do something like this back in the day, to get rid of the need to write "struct foo" all the time:
typedef struct _foo { ... } foo;
This way you could use foo as the type instead of "struct _foo". That's why I made the mistake...
Nice video, very well explained😁 The only thing that I'm not sure is that you use the FP_SEG and FP_OFF on near pointers, and those macros might not give the result you want, given that the FP_ prefix of those macros stands for far pointer. Besides, you have shown that a near pointer has a size of 2 and contains only the offset, so where would FP_SEG get the segment information from?
Probably the contents of DS/current data segment.
@@root42 makes sense, thank you😁
I have to ask, does this version of Turbo C not support typedefs or was that an intentional avoidance so as not to muddy the waters for this discussion?
Of course it supports typedefs. And yes, I avoided it as not to introduce another concept. I also could have talked about output parameters and how they could be implemented using pointers… and so on…
@@root42 *nods* I couldn't remember how old typedefs were. I keep running into the issue of still thinking of C/C++ in terms of the '99 versions of the spec since that's when I was taught them formally, and it got me thinking about when the concepts I'm accustomed to just assuming are supported actually saw widespread acceptance.
Turbo C 2.0 is mostly ANSI C compatible. That changed very little until C99. The latter got a lot of the quality of life changes from C++98. Like mixed declarations and code and C++ style comments. Basically C++ without the OOP cruft. ;)