Cursed Coding: How the Void* Does Anything with Nothing

Поділитися
Вставка
  • Опубліковано 26 чер 2024
  • Why is my channel called Voidstar Lab?
    Try Brilliant free for 30 days and get 20% off at brilliant.org/zackfreedman
    Support me on Patreon! / zackfreedman
    Support me on Thangs! thangs.com/zackfreedman
    Meet me and make friends! / discord
    Doomscroll me! x.com/zackfreedman
    A PROGRAMMING EPISODE?! Egads! Gadzooks! It's a good one. C and C++ feature a bizarre keyword: void* represents a memory address whose data are unknown or totally absent. This meaningless map to nothing enables function pointers, universal memory management, and event-driven architecture - all practical ways to code cleaner, faster, and with fewer bugs.
    This is an introductory programming video for beginners and intermediate coders. Advanced users have probably used tons of these already, but who knows? You might now know everything these five bizarre characters make possible.
    Credits:
    Interference SFX: Partners in Rhyme
    Other SFX: zapsplat.com
    Silly, silly stock footage: Storyblocks
  • Наука та технологія

КОМЕНТАРІ • 1 тис.

  • @goodboiadvsp3297
    @goodboiadvsp3297 10 місяців тому +839

    Id like to think that this video was based off of my question at the meetup 😁
    Edit:
    OMG THAT WAS MY QUESTION

    • @Andrew90046zero
      @Andrew90046zero 10 місяців тому +2

      Wait what?

    • @infectedrainbow
      @infectedrainbow 10 місяців тому

      @@Andrew90046zero It seems they went to the AMA and asked why the channel was called Voidstar.

    • @flabort
      @flabort 10 місяців тому

      ​@@Andrew90046zeroIn other words, @goodboiadvsp3297 was pleasantly surprised to see themselves in this video, when a circle of superfans were doing a Q&A at the convention.

    • @flabort
      @flabort 10 місяців тому +8

      3:05 in the video at Open Sauce

    • @Andrew90046zero
      @Andrew90046zero 10 місяців тому +2

      @@flabort oh right, duh! XD

  • @TheRamblingShepherd
    @TheRamblingShepherd 10 місяців тому +827

    I'm in my first week of an introductory C++ class. Listening to this video is like swimming in the ocean and feeling something warm and very solid brush your foot. There's something there; you can vaguely apprehend its shape. But the unknown holds primarily terror.

    • @frankhaugen
      @frankhaugen 10 місяців тому +30

      I'd say it's more like peeing in your pants to keep warm in a blizzard

    • @bachaddict
      @bachaddict 10 місяців тому +9

      good luck! I did quite a bit of embedded C and never used this, but understanding pointers is a must

    • @murdocII
      @murdocII 10 місяців тому +7

      It's a shark, those pointy stars bite like hell, try to be smart

    • @f3rny_66
      @f3rny_66 10 місяців тому +18

      starting to learn c++ is like starting to learn to build a house from atoms, except you are in acid and the house exist only in your head until you compile and realize that the house is actually a 5 headed alien because you pointed some electron to the wrong galaxy

    • @frankhaugen
      @frankhaugen 10 місяців тому +3

      @@f3rny_66 agreed 👍
      Now that C# is getting all the low-level niceties, and native C# IoT units are available, I'm starting to get rid of c/c++ knowledge

  • @filker0
    @filker0 10 місяців тому +274

    I use "void*" for a lot of things:
    * Data Hiding
    * Polymorphism
    * Generic memory operations
    I seldom use objects of "void*" to hold the address of functions because it bypasses argument validation and conversion. I use typedefs for callback function pointers and use "union" when I need a single function pointer to call functions with different interfaces depending on context. The generic button press would be "typedef void (* buttonPressedCallback_t)(void);" - No arguments/parameters, etc.
    Disclaimer: I'm a prehistoric C programmer from before the ANSI standard and C++ and lived through the C standard library "char*" to "void*" cataclysm.

    • @gedr7664
      @gedr7664 10 місяців тому +20

      you are a true wizard

    • @duncathan_salt
      @duncathan_salt 10 місяців тому +27

      I use void* for function pointers, because I don't actually write C myself - I decompile it. void* is lovely for function pointers when you don't have a clue what their signature is! lmao

    • @622.by.sunrise8
      @622.by.sunrise8 10 місяців тому +5

      Polymorphism is a blessing to modern programming.

    • @guigs4467
      @guigs4467 10 місяців тому +10

      "...and lived through the C standard library "char*" to "void*" cataclysm."
      Could you please elaborate?
      It seems interesting and my googlefu hasn't returned anything.

    • @FireCrack
      @FireCrack 10 місяців тому +11

      ​@@guigs4467long story, but long ago in the times of yore "void" wasn't a thing, and the standard way to have an arbitrary pointer was instead a char*

  • @greg4367
    @greg4367 10 місяців тому +173

    As a C programmer of 50 years I actually understood this topic perfectly... Until you tried to explain it. The best metaphor is no metaphor at all.

    • @purplelord8531
      @purplelord8531 10 місяців тому +14

      that's... a revelation to me
      i have had that exact experience before but you put it into words

    • @TheBlacktom
      @TheBlacktom 9 місяців тому +5

      As a non-programmer for whatever years I felt the same. Except I didn't understood it before and don't understand it now either.

    • @squelchstuff
      @squelchstuff 9 місяців тому +1

      So, that's a metaphor* ?

    • @LeoInterVir
      @LeoInterVir 9 місяців тому

      I never really understood pointers when I had a class in C++, now I'm scared of their power.

    • @kevin42
      @kevin42 8 місяців тому

      Golden rule of engineering

  • @UrknetLabradories
    @UrknetLabradories 10 місяців тому +134

    You possess a particularly potent proficiency for pinning us ADD people in place.
    Usually i'm off to try (and fail) something half way through an explanation of it but i never miss a second of one your videos.
    I know it's not a money maker but more coding when you can afford it would be awesome!

  • @henrivandenhatert2
    @henrivandenhatert2 10 місяців тому +314

    As an embedded engineer, please do more of this, it's great.

    • @littlefrank90
      @littlefrank90 10 місяців тому +6

      As a former java developer, I am scared of this kind of programming.

    • @Dent42
      @Dent42 10 місяців тому +11

      > As an embedded engineer
      Do you need help getting out?

    • @Lameless
      @Lameless 10 місяців тому

      ​@@littlefrank90As an c++ developer, help.

    • @michaelkilby4046
      @michaelkilby4046 10 місяців тому +3

      As an IT person who knows too little programming, this was awesome, do more!

    • @henrivandenhatert2
      @henrivandenhatert2 10 місяців тому +2

      @@Dent42 It is hard getting out, when I am embedded.

  • @carrottopevans
    @carrottopevans 10 місяців тому +83

    As a non-programmer who is just interested in making and 3d printing, this was so informative and held my attention the whole way through! Congrats on taking a leap to branch out while working on larger projects

    • @SeanCMonahan
      @SeanCMonahan 10 місяців тому +3

      Zack doesn't want to be... _typecast_ 😎

    • @802Garage
      @802Garage 9 місяців тому +1

      ​@@SeanCMonahanI see what you did there.

  • @cooperised
    @cooperised 10 місяців тому +22

    I use void * a lot because I do firmware work in straight C. Super useful. But the biggest downside is that you almost immediately lose any of the mediocre type safety that the compiler provides. I use function pointers a lot too, they're pretty handy and retain type safety.

  • @raddaks2039
    @raddaks2039 10 місяців тому +8

    Yo rest in peace, isekai elf mahiro-chan. The voidstar patreon list will never be the same without you.

  • @TheColorman
    @TheColorman 10 місяців тому +23

    I'm pretty sure parent class methods are supposed so work like how you describe void*, where classes inheriting from the parent promise to implement specific methods that are then called somewhere else regardless of what class it is; as long as it inherits from that specific parent.

    • @icebird76
      @icebird76 10 місяців тому +5

      That's what I was thinking. Inheritance should exist in C++, but maybe the complication was identifying the cartridge type, instantiating, and firing the method since no code is on them.

    • @Lord_zeel
      @Lord_zeel 10 місяців тому +8

      Yeah... I'm not sure exactly why he found dependency injection to be so much simpler than OOP for this. The described situation is practically exactly what OOP is for. It could be that the program was badly structured from the outset, and any refactor would have greatly improved it. It could be that he just isn't very good at OOP - he's admittedly not a programmer by trade, and OOP can be a bit daunting and it's easy to mess up. Functional programming is probably easier in this case, though I think a well designed object oriented approach would still be better and MUCH simpler for other people to use if you're going to share it.
      Truly, the greatest strength of OOP is in creating code that you intend for OTHER people to use. Abstraction, encapsulation, polymorphism. All that stuff is really important when you want to have code that you can make improvements to later without massively breaking stuff other people used it for, and it's much simpler for someone else to actually interact with as they only need to understand the interface.
      For your own personal code, or for core application code, it's usually too much overhead. But for a library or API? There's a reason that most popular modern programming language have OOP features, even if they aren't the star of the show.

    • @rbdesignsnh
      @rbdesignsnh 4 місяці тому

      @@Lord_zeel i was thinking much the same thing.

  • @loserssoldier
    @loserssoldier 10 місяців тому +14

    Zach, I think your show has been at its strongest when you’re teaching. My favorite episodes have consistently been the ones where you’re describing how tech concepts work, like the pick-and-place robot and the Diamond tip episodes. Would love to see more of this kind of thing!

  • @TheDarkPreacher65
    @TheDarkPreacher65 10 місяців тому +94

    Zack, you are not known for making videos that typically bring tears to the eyes (unless you purposefully mispronounce something to trigger the comment trolls), but at the end of your video, where you talked about isekai elf mahiro-chan ~desuyone~, I was reminded of two of my own Patreon supporters who passed away and cried a little. Both of them were in my Discord server, and I couldn't bring myself to kick their accounts that their families never had the thought to delete after their passing, so I made a new role specially for them. They are now the server's Guardian Angels (I'm TheDarkPreacher, everything is kinda religion themed). One passed away so suddenly that I only found out he had been sick when I got a message on Patreon for an exit survey that simply said "He died." The other was the mom of one of my wife's friends, and we knew she was in poor health. It was very touching that you included isekai elf mahiro-chan ~desuyone~ in one last video before their patreon ran out. Here's hoping they are enjoying their life in a fantasy world and take any knowledge they gained from your videos to become an OP character that ends up ruling the world. Or at least, they are resting in peace.

    • @Hellmark
      @Hellmark 10 місяців тому +20

      After my wife died, it was kinda hard to cancel her Patreon subscriptions. After a certain point, I did have to make some budgetary changes (I got laid off after she died, and the job I got after that paid drastically less, plus going to a single income while still having about the same expenses can be hard. Like did you know car insurance for one person actually cost more than for a married couple combined?). What I ended up doing, was setting her name to reflect her passing by adding "RIP (1982-2021)" and running that for a few months before ending her subscription. I've not checked to see if anyone has done anything in honor of her (some of them I wasn't able to, because I don't have access to all of her accounts), but I hope they did.

    • @42436freak
      @42436freak 10 місяців тому +8

      Welp, now I cried. Thanks for that. Lost my best friend in November and it still hurts like hell. Loss is weird, comes in waves, and life is more fragile than we think.

    • @802Garage
      @802Garage 9 місяців тому

      So sad and very nice of him to mention.

  • @danielalexander8402
    @danielalexander8402 10 місяців тому +34

    10/10 for more programming based content. That’s the kind of content I’ve wanted to watch for a while.

  • @elideaver
    @elideaver 10 місяців тому +43

    It never occurred to me that void star meant void pointer lol

    • @namAehT
      @namAehT 10 місяців тому +11

      Same, I thought it was a pretentious name for a black hole.

    • @AileTheAlien
      @AileTheAlien 10 місяців тому +6

      😅@@namAehT yeah, I've always pronounced these as "pointers" not "star". (Or depending on what you're doing, you're talking about "address", "take the address of", "dereference", etc.)

    • @ethanjennings6442
      @ethanjennings6442 10 місяців тому +2

      I've also heard people pronouncing * as splat before. Void Splat Labs doesn't have the same ring to it.

    • @drdca8263
      @drdca8263 10 місяців тому +1

      @@ethanjennings6442not the same ring, but certainly *a* ring

    • @Ethan_Simon
      @Ethan_Simon 10 місяців тому +1

      ​@@namAehT tapped on this video from my recommendations expecting a physics video lol

  • @wowzande
    @wowzande 10 місяців тому +39

    C++ was the first language i learned . I havent touched it in years except modifying some stuff in marlin. Im rather surprised you did this video. I would like to know more . Keep up the good work!

  • @JashJhaveri
    @JashJhaveri 10 місяців тому +27

    You explained the utility of using pointers so nicely. Thank you!

  • @davespriter
    @davespriter 10 місяців тому +5

    this was the most interesting programming video i’ve ever seen. your enthusiasm for conveying the quirkiness of void* is a great example of what i love about this channel

  • @wherearemypants2213
    @wherearemypants2213 10 місяців тому +8

    void* in c is like duck-typing in python : it allows you to treat data however you please without explicit interfaces / inheritance.
    It does make the code less legible though, since the 'contract' you hold with said data is implicit.
    Blender's source code is actually is full of voidstars and it is a mess to work with.

  • @GeekySquidoo
    @GeekySquidoo 10 місяців тому +8

    I’ll admit, I don’t really understand or follow a lot of the programming stuff you do, but I love the way you present it so I really enjoy videos like this :)

  • @evanbarnes9984
    @evanbarnes9984 10 місяців тому +7

    Hey! Please do more of this! Way too many of my favorite creators like you skip over the programming because they're worried that people will find it boring. Maybe some do, but the rest of us ate fascinated and need more!

  • @KaylaGraves
    @KaylaGraves 10 місяців тому +39

    As someone who uses C# a lot, that joke murdered me. I'm now a Java Fanfic coder. Updating Resume.

    • @GreenlandRobot
      @GreenlandRobot 10 місяців тому +7

      As a python developer I removed any reference to programmer from mine

    • @KaylaGraves
      @KaylaGraves 10 місяців тому +2

      @@GreenlandRobot brutal.

    • @BinaryRhyme.JackOfArts
      @BinaryRhyme.JackOfArts 10 місяців тому

      Lol. Yeah, loved that line.

  • @AWMLGaming
    @AWMLGaming 10 місяців тому +57

    i just imagined i was a delivery driver... worst day of my life

    • @tf5pZ9H5vcAdBp
      @tf5pZ9H5vcAdBp 10 місяців тому +2

      There's worse jobs out there so consider yourself blessed. I delivered pizza as a second job for a while and audio books are a game changer in that field.

    • @user-ep9zv4se3s
      @user-ep9zv4se3s 10 місяців тому +1

      I worked for Amazon. They could not manage delivery.

    • @brokeandtired
      @brokeandtired 10 місяців тому +2

      I am a food courier...whatever you imagine can't come close to how bad it can get.

  • @ConstantStream69
    @ConstantStream69 7 місяців тому +1

    "I love to learn, but hate being taught" such a simple concept, but one that had never crossed my mind before. 100% relatable

  • @strelkomania
    @strelkomania 10 місяців тому +30

    I actually really enjoy these types of videos from you ! As well as your editing style, it helps my shirt attention span lol

    • @tdgchan
      @tdgchan 10 місяців тому +4

      Shirt attention span? Mine has to be a napkin then...

    • @strelkomania
      @strelkomania 10 місяців тому +2

      @@tdgchan 😂😅 I definitely meant short* but your reply is too awesome, I won't fix my typo

    • @collectorguy3919
      @collectorguy3919 10 місяців тому +4

      @@strelkomania I took "shirt" attention span as an intentionally ambiguous typo of "short" or "shit"

    • @strelkomania
      @strelkomania 10 місяців тому

      @@collectorguy3919 😂i love that

  • @zilog1
    @zilog1 10 місяців тому +16

    Omfg please more of these videos. You make programming actually make sense. You have no idea how valuable you are to people wanting to learn.

  • @BinaryRhyme.JackOfArts
    @BinaryRhyme.JackOfArts 10 місяців тому +5

    Loved the vid. The void* is great for prototyping, but I shudder to think of it being used in large production code bases, lol. I've become a fan of C# in my dotage, and some of the constructs like interfaces to allow for polymorphism without baroque class inheritance trees.
    Keep on keeping on. Love your stuff.

  • @LevelUpYourFandom
    @LevelUpYourFandom 10 місяців тому +8

    i actually liked this episode a lot. im down for topics that are tangential to your 'norm' but still relevant to the norm, and in your classic hilarious style. great job

  • @justinlynn
    @justinlynn 10 місяців тому +2

    [slaps side of compiler] This no-thing can do SO MUCH any-thing - [quietly] but, mostly, it's just SIGSEGVs.
    But seriously, this is great! I love this :D

  • @williamnollert486
    @williamnollert486 10 місяців тому +9

    Can’t wait for the bigger project vids but love this content as well. Keep it coming!

  • @floorpizza8074
    @floorpizza8074 10 місяців тому +3

    Zach, I haven't written any code in over 20 years. Even so, you're such a great teacher, I understood everything you said. Have you ever considered a "Learn Programming From Scratch" series where you do your own take on Dave Mark's classic books "Learn C On the Mac" and "Learn C on the PC"? For those not familiar, Mark's books were famous for taking someone with zero knowledge of programming and getting them proficient in C in an easily understood way.
    As I said, you're such a great teacher, you could take someone that has never done a "Hello World" and have them competent in C in short order. And since Dave Mark hasn't updated his books in years, he has left a *Void* to fill.
    I'd even pry open my wallet to take such courses from you.

  • @engineer0239
    @engineer0239 10 місяців тому +1

    Beein studying computer science for 2 years now, and this Video opened my eyes on how Event driven Architecture works on C++. We only briefly discussed how it works in Java, but this video was a very useful addition! Thank you so much!

  • @christopherkopperman8108
    @christopherkopperman8108 10 місяців тому +2

    For non-coders a pointer is very similar to how pronouns work. A pronoun doesn't describe a thing (the nouns and adjectives do that) a pronoun refers to the noun that describes the thing. The same reason they do it in coding is the same reason we do it in any language, describing a thing makes a new instance of that thing while referring to a thing does not. This makes it easier in both computation and on one's cognitive strain. For any confused about houses and such in Zach's description. A pointer is basically saying "Hey remember that thing that I previously established, often in detail? Yeah, talking about it again."

  • @kleinlui
    @kleinlui 10 місяців тому +4

    I don't think void* for callbacks is a great idea, but for passing data through callbacks it's pretty much the only thing available. E.g. a download function also gets a void* provided by the caller, and in the callback you can cast it back to your own type and check e.g. what the download URL was, when it was started or whatever else you want to store in there.

  • @hikirj
    @hikirj 10 місяців тому +11

    Wow. Absolutely loved this video Zack! Would love to see more coding-oriented videos like this

  • @ACoupleStoners
    @ACoupleStoners 10 місяців тому +1

    Not only did you keep me hooked the whole time, I went back a second time to understand better. You're videos are incredible.

  • @AB-Prince
    @AB-Prince 10 місяців тому +5

    😂 as a hobbyist c# programmer. "cup of error" just makes me crack. I need a cup of error for my computer desk now.

  • @consciouscode8150
    @consciouscode8150 10 місяців тому +7

    Fun fact: int `*foo; (ignore the ` - youtube has no escape sequences) is technically more correct because the star is associated with the name, not the type. You can see this more clearly when you declare multiple pointer variables: int `*foo, `*bar, baz; (baz here is an ordinary int). The idea is that the value of that variable *dereferenced* is int.

    • @Lord_zeel
      @Lord_zeel 10 місяців тому

      I prefer to think of it as "the type of 'foo' is 'pointer to an int'" - the actual value at foo is the address of something, so the data type of foo is pointer. Thus just as 'int foo' is an int, 'int* foo' is a pointer to an int. Saying 'int *foo' seems nonsensical to me.

    • @RiderAnton
      @RiderAnton 10 місяців тому +2

      ​​​@@Lord_zeelthe problem is that int* does not cause all following declared variables to be int pointers: `int* var1, var2, var3;` is a common trap in C/C++ exactly because of that. You may think var2 and var3 are pointers, but they're actually integers.
      If you want var2 and var3 to be pointers in that line, you /must/ write it as `int *var1, *var2, *var3;`

    • @isodoublet
      @isodoublet 9 місяців тому

      @@Lord_zeel It actually is the only thing that makes any sense. Granted, it only makes sense because C's variable declaration syntax is absurd, but it does make sense. The idea is that "declaration follows use" -- the syntax for declaring a type mirrors how you use that type. So for example you declare an array like int a[3];, which is also how you index into it. Same goes for pointers, you write int *a; because a is a variable that, when dereferenced with *, will produce an int.
      I think there's not a single person in the universe who in 2023 thinks this syntax was a good idea (including the original designers of C), but we're stuck with it. There's two choices from here: one is to reject this 'feature' of C and try to pretend it has a more normal declaration syntax. You'll have to make some house rules (like never declare more than one variable in the same statement), and it'll always carry some residual wonkiness, but you can do it. This is where you write int* a. The other choice is to embrace the suck and accept that this is the way the language was designed, and try to work with it instead of against it. You'll have to adjust your thinking, but you won't have to make any house rules, and it'll always work consistently. This is where you write int *a.

  • @WhoWatchesVideos
    @WhoWatchesVideos 10 місяців тому +6

    Now I'm _really_ concerned about how you managed to have a callback as a method devolve into chaos such that replacing it with a bare function solved your problems.

  • @ZenithWest169
    @ZenithWest169 10 місяців тому +2

    Yeah my professors hated my coding style. I absolutely loved my array of void*'s how I'd loop over them changing data. Had one class where your graded on actual performance. Get your program to run in 10 minutes=70, 7.5min=80, 6min=90 and sub 5min was a 100. Me and the prof competed and I beat him in all but one project pushing sub 30 seconds. He said he hated my code with a passion but couldn't argue how efficient it was.

  • @Ishsa
    @Ishsa 10 місяців тому +2

    I just love learning this stuff. I'm a musician and love making my computer do math, but I have a tough time learning real programming skills, so this kind of thing really helps to open up my idea factory

  • @chri-k
    @chri-k 10 місяців тому +5

    You should’t use void* for function pointers. You should use actual function pointers ( the syntax is ret_type (*name)(args) ), that way the compiler and people reading the code will be able to tell what the callback function should look like.

    • @GabrielSoldani
      @GabrielSoldani 8 місяців тому

      It’s actually undefined behavior to cast function pointers to void*. This isn’t much of a problem in modern PC architectures, but void* is a type for _data_ pointers. You can imagine a machine where code is stored in ROM and data is stored in RAM that the types used to address them could be completely different, and of different sizes. This happens in IA-64 and 8086 16-bit real mode, apparently. It _is_ legal to convert function pointers to any other function pointer type, so if you want to store a pointer to any function, you can cast it to void (*)(void).

  • @Shoefly007
    @Shoefly007 10 місяців тому +3

    Great episode! Thank you for simultaneously melting my brain and making me feel less stupid for always struggling with OOP.

  • @LumanilTheMentor
    @LumanilTheMentor 9 місяців тому

    Just found your channel Zack, and i dont even 3D print, but i cant stop watching. You're a genuine joy to watch! Cant wait for the next one.

  • @justinbanks2380
    @justinbanks2380 7 місяців тому

    Please continue doing these type of teaching videos from time to time about whatever topics you choose.
    This was great. I finally got an answer or two to the exact difference and use case for some terminology and things in code that I've been using for years now but never fully understood

  • @namAehT
    @namAehT 10 місяців тому +3

    Holy fuck I was just re-watching random old videos looking for that sweet Voidstar dopamine hit.

  • @_gamma.
    @_gamma. 10 місяців тому +6

    I hadn’t connected the lab name, it’s pretty genius. I enjoyed this video, even if I am a python “programmer” 🐍

  • @xphreakyphilx
    @xphreakyphilx 10 місяців тому +2

    Thanks for reminding me why I prefer Rust over C/C++. In Rust basically every time you'd use a void* you can deal with it in a type-safe way.

    • @isodoublet
      @isodoublet 9 місяців тому

      C++ has type safe alternatives too.

  • @loganq5152
    @loganq5152 10 місяців тому +3

    Void Star is also the name of my favorite book.

  • @MachFarcon
    @MachFarcon 10 місяців тому +3

    First, you did an awesome job explaining things at a high level, though I will admit that while I'm not a programmer, I have dabbled in scripting for my sys admin job so it was somewhat easy for me to get what you were putting down. Baller job!
    Secondly, it might just be the fact that I'm working on building the magic system for my TTRPG, but your explanation also felt like you were explaining the inner workings of conceptual magic, and it was awesome. To an average non-magical (or non-technical) person, it probably would be like "those indeed are those spell-words. I understand the concept you explained, but still spell-words." Which is doubly awesome. Keep up the good work!
    And if the algorithm permits (praise be), I wouldn't mind seeing more code in your future videos.

  • @isthattrue1083
    @isthattrue1083 10 місяців тому

    Been waiting on this. Thank you Zack.

  • @scottwilliams895
    @scottwilliams895 10 місяців тому +1

    Zack, your writing & delivery is brilliant! I'll watch any video you make on any topic; code, 3d, cyborg, home renovation, anything!
    One day I hope to hear my name in those credits

  • @LucasTheDrgn
    @LucasTheDrgn 10 місяців тому +3

    As someone who taught themselves python and then ended up using it for college projects over the languages i had to pay to be taught, I do find it funny that this video starts with ragging on python and then goes on to explain a concept that is intrinsic and intuitive in python. I have replaced the built-in print function because i wrote a program and then later decided i wanted to do more with the logs than just output to stdout. I may have actually done this as part of my college homework so I could test it by outputting to stdout and then turn it in with it outputting to a file, as the professor wanted.

  • @dip8
    @dip8 10 місяців тому +5

    wow the video was amazing! good job

    • @ShadowMaelstrom
      @ShadowMaelstrom 10 місяців тому +1

      Amazing you can watch a 21 minute video in under a minute

    • @dip8
      @dip8 10 місяців тому

      @@ShadowMaelstrom im just fast dw abt it

    • @ShadowMaelstrom
      @ShadowMaelstrom 10 місяців тому

      @@dip8 bet the ladies love you

    • @dip8
      @dip8 10 місяців тому

      @@ShadowMaelstrom lol

  • @Windgazer42
    @Windgazer42 10 місяців тому +2

    I think that was a relatively clear definition of what a void * does, but I don't know C all that well. All I kept thinking at first was, what's so special about that, we do all of that stuff all of the time in Javascript.
    But thinking back of when I was doing Pascal and even for a short time some C, it would've been great to have known about this back then!

  • @catsfan2937
    @catsfan2937 10 місяців тому

    I think this video had the least useful (but most entertaining) explanations of a void pointer I've ever heard :)
    Would love more videos like this! Especially the devlog bits about your old prototypes are very cool

  • @SlimyRedstone
    @SlimyRedstone 10 місяців тому +3

    We want more of you explaining programming concepts ! (By the way I didn't know the power that void* has...)

  • @devjock
    @devjock 10 місяців тому +6

    12:47 Zack, you know your audience is "special" enough they can detect a rickroll by the video-ID alone..

  • @benfrost5317
    @benfrost5317 10 місяців тому

    This video was Fantastic. Please make more of these!

  • @LuxmasterCZ
    @LuxmasterCZ 10 місяців тому

    This vid was very fresh. I like when you talk concepts more than things, good job!

  • @mskiptr
    @mskiptr 10 місяців тому +4

    After dabbling in type theory, I now find Idris | Haskell | Rust 's Void much neater. It has this curious property that there's no expression that would be of this type. Useful for marking functions that do not return - that is loop or do jump somewhere but will never come back.
    But when a function does return, just nothing of value, its return type can be Unit - which has exactly one possible value (like the 0-length tuple). Sort of a placeholder that roughly corresponds to the void return type of C-like languages.
    And if you're doing theorem-proving, Void is an impossible proposition while Unit corresponds to something trivially true.

    • @computationaltrinitarianism
      @computationaltrinitarianism 10 місяців тому +1

      Yay. A person that uses a dependently typed language. There are dozens of us.
      I recommend you checkout Lean 4 if you haven't already. The codebase of the language itself is quite fun to read as well since the compiler is (mostly I think) self hosted.

    • @isodoublet
      @isodoublet 9 місяців тому +2

      I'm not much too fussed with what a type is called, but I do have one gripe with how void works in C/C++, which is that it isn't a real type. You can't make a variable of type void and assign it the only possible value -- the language says that doesn't mean anything so clearly you would never want to do it. Except C++ also gives you templates to write code that works generically, and it would be damn convenient to treat void like any other type, the way Haskell's Unit works.

    • @mskiptr
      @mskiptr 9 місяців тому

      ​​@@computationaltrinitarianism
      Sadly YT has hid your comment (it's still invisible for me, unless I sort everything by 'newest').
      As for Lean, it's on my radar, though I don't know much about it nor about Agda.
      The first time I tried to learn Coq I didn't understand enough of how it works under the hood to really use it. I need to try again!
      But recently a friend has told me about Natural Number Game which is built around Lean so that will likely be my next step.

  • @mattmakesmachines
    @mattmakesmachines 10 місяців тому +4

    I’ve never clicked on a notification so fast lmao

  • @andrewchapman2039
    @andrewchapman2039 10 місяців тому +2

    Dude you're expanding my mind right now and I didn't sign up for that. I had things to do today and now I'm thinking about Void*-mediated modularity in physical systems.

  • @user-zj8hf1js4z
    @user-zj8hf1js4z 10 місяців тому

    I can't believe it. You finally explained pointers in a way that makes sense. I've struggled with this concept for five years, no explanation in any book, wiki, comment, stack overflow, chatGPT question has ever been able to do. I gave up on C because of this. Thank you. I will, perhaps, dip my toes hesitantly back in those waters.

  • @honzas.5234
    @honzas.5234 10 місяців тому +10

    I would definitely want to see more of the code in your project videos.

  • @dip8
    @dip8 10 місяців тому +3

    4:17 I already feel offended lol

  • @DiThi
    @DiThi 10 місяців тому +2

    If you like both Python and very low level bare metal programming, you may like Nim. It looks like Python, it has many more features than Python (like generics, macros, function overloading, custom operators), it's as fast as C, and it compiles to C/C++ so you can use in about *anything* like obscure microcontrollers that only have a crappy C compiler. Using ARC as memory manager it inserts the mallocs/frees automatically where needed and it doesn't have GC pauses. It's very easy to interface with C, C++ and ObjC libraries. It also compiles to JS but in most cases it's much better to tell it to use emscripten.

  • @andykphoto
    @andykphoto 10 місяців тому +2

    As an IT Professional for the last 20 years, and a recovering computer science student, I deeply enjoyed this video. I mean, most of them are pretty awesome, but this one hits different. 😸😹

  • @radical_ans
    @radical_ans 10 місяців тому +3

    I am in the Pen-Pineapple-Apple-Pen goldilocks zone.

  • @user-fk6sy7if8e
    @user-fk6sy7if8e 10 місяців тому +7

    I like your funny words computer man.

  • @chadcrocker
    @chadcrocker 10 місяців тому +1

    I started my career with C and C++. Hearing all of this brought back great horror memories! Keep doing what you do!

  • @jameskelly827
    @jameskelly827 10 місяців тому

    This is now my favorite video of yours. Please do more code videos!

  • @HyperDash
    @HyperDash 10 місяців тому +3

    better explanation of literally any cs concept than any of my tenured professors over the last 4 years
    and this is why my degree was completed on the combined efforts of random internet people with strong accents and MIT OCW
    and also why i graduated with a cs degree and immediately went into the field of art 😂

  • @pwarrow8858
    @pwarrow8858 9 місяців тому

    I really enjoyed this type of video. Please do more of these.

  • @BeckyStern
    @BeckyStern 10 місяців тому

    Love it! Thank you Zack!

  • @granger7664
    @granger7664 9 місяців тому

    My favorite video of yours so far! More code videos 🙏🏻

  • @tcurdt
    @tcurdt 10 місяців тому +1

    I am impressed. Who would have thought you can talk almost 22 minutes about such a simple thing as a void*

  • @dirtdart81
    @dirtdart81 10 місяців тому +1

    Haven't touched C or microcontrollers for a long time, but videos like this get me itching to jump in again. Thanks for a lovely vid!

  • @2010AZ
    @2010AZ 10 місяців тому

    This is a great episode of voidstar lab, need more.

  • @lukasmodry196
    @lukasmodry196 10 місяців тому

    iam a programing and software dev student and this is a best video ive seen on void* so far :D. Keep it up man. Thnx

  • @SmoinsLP
    @SmoinsLP 10 місяців тому +1

    I cant believe I lived without this until now, cant wait to try using it and giving up after 5 mins

  • @scripter1282
    @scripter1282 10 місяців тому

    I now attach "on complete" conditions and output variables to the ends of some of my OOP code because of this video. any task can now start any other task, and more easily pass data between them. very helpful!

  • @SolarShado
    @SolarShado 10 місяців тому

    Dude, you're _killing it_ with the jokes in this one. I've lost track now of how many times I've had to pause/rewind because I was laughing and missed something, and I'm only just over halfway through!

  • @lamMeTV
    @lamMeTV 10 місяців тому +1

    The first 17 minutes really went in one ear and out the other. But then the example of the modular remote thingy really made it click. I love void stars now! Way easier than oob

  • @jph290
    @jph290 10 місяців тому

    I love this. It is a good way to show why some things are done a certain way that breaks conventional practice.

  • @joshuabell6835
    @joshuabell6835 10 місяців тому

    It was great. Your delivery made it great.

  • @kadet1090
    @kadet1090 10 місяців тому +1

    On my studies we always joked that skill of the programmer / hardness of the program could be expressed with "star rating", i.e. maximum number of "stars" attached to any type (especially beloved void) in the program. Of course usage of such indirect reference must not be just for show, but have practical use. For now, 3 stars is all I've got.

  • @DavidBrown-xn2pg
    @DavidBrown-xn2pg 10 місяців тому

    Love this, keep it coming!

  • @Xx32123
    @Xx32123 10 місяців тому

    Please do more of videos like these where you teach and stuff I love them!

  • @scum-scum
    @scum-scum 10 місяців тому

    Thanks for making this!

  • @Bp1033
    @Bp1033 10 місяців тому

    Yes! More code stuff! I never thought to assign a pointer void before, I'm going to try this out.

  • @crazybird199
    @crazybird199 10 місяців тому

    I was just binge-watching you videos a few minutes ago, epic timing!

  • @AndyOz2012
    @AndyOz2012 10 місяців тому

    Great video! I recently have started to feel like I have a solid grasp of the object oriented programming style, now upon learning what EDP is its time to learn some more!

  • @Kosro
    @Kosro 10 місяців тому +1

    Loved the episode ❤ I know you can't switch things up like this every video, but you totally should!

  • @RyushoYosei
    @RyushoYosei 10 місяців тому +1

    You mention that whole bit with the Quagsire, and the funny thing, Gamefreak did that very thing in Pokemon Sun and moon, using the same model fully duplicated for various scenes, a fully independent copy of the model, even though there was no real differences, rather then just one model they could reference and set a state too. According to twitter and some other places its to "Make it load faster." Since it was right there with everything else, rather then being something it had to pull from another location.

  • @elitemantis
    @elitemantis 10 місяців тому

    I coded in C/C++ for like 15 years, haven't used it in another 15 and now I totally forgot that void* even existed. Thanks for that blast from the past!

  • @dankay9202
    @dankay9202 10 місяців тому

    That was pretty neat, I'll definitely check out this video again for reference on my next project

  • @Rivenwolf2
    @Rivenwolf2 10 місяців тому

    Thank you for breaking down something I had no idea existed! I thought about getting into programming, but now I will think of it more!

  • @strudelkopf
    @strudelkopf 10 місяців тому

    I really didn't expect the deep meaning behind the name! That's beautiful, really

  • @SkateSoup
    @SkateSoup 10 місяців тому +1

    This video was a thousand times more coherent than my first semester of C in college.

  • @dolfandringa
    @dolfandringa 10 місяців тому +1

    I like how the video evolved into loose coupling, event driven architecture, and functional vs object oriented programming all from the void pointer.