Advanced C 31: Complex Numbers

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 21

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

    Thank you for this video. Could you maybe do one about typeof and "emulating" templates in C23?

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

      I have made a video about macro tokenize: ua-cam.com/video/zSx4csJVLig/v-deo.html
      Which I have used to emulate templating in one of my project: github.com/cacharle/dynamic-array/blob/master/src/dynarray.h
      I have glanced at the new `typeof` of the C23 standard but it's not 100% clear to me how it's useful for templating.

    • @Brad_Script
      @Brad_Script 6 місяців тому

      @@cacharle my guess is that you don't have to pass the type as a parameter anymore, it can infer it with the typeof operator

    • @ban5176
      @ban5176 6 місяців тому

      Yes, but if you want to embed the types into the structure's name, typeof won't work as it is a compiler directive and doesn't produce valid preprocessor token. E.g. typeof(3) is still typeof(3) after the preprocessing, if it evaluted to int, we could use that

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

    this is absolutely my favourite series
    I'm in a weird spot where I'm above a beginner yet not that advanced to call myself intermediate (Just made a couple simple game engines and simple stuff, they sound way more complex than they actually are)
    So your videos are absolutely beneficial
    Merci pour vos efforts et je vous souhaite une bonne chance!

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

      Well, you're exact target audience for this series so I'm glad it helped you.
      I was in a same situation at the beginning of my C journey where I was missing a place to learn the more intermediate/advanced stuff that wasn't a 3000 line man page.

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

      @@cacharle precisely, I'm doing freelance as a web dev and JavaScript is, in my opinion, brain rot that is a pain, TypeScript does lower it a bit but still not what I like
      C on the other hand is very simple, it's very powerful and is a statically typed language, so your series are the exact thing I need to actually get to the next level
      I really wish you the best and I hope you can keep this series rolling as we all learn new things with time

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

      @@spounka ah yes, I remember having a webdev phase aswell 😅
      The only thing I liked about JavaScript was the fact that it was the first mainstream programming language to make heavy use of the functional programming paradigm which I love. Beside that it's quite a painful language and community.

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

    I think the cfmt function has a bug.
    If you use it more than once in the same print statement, it would give the same string for all uses.
    This is because of the static char buffer you return a pointer to.

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

      Indeed, it was just a little function I made to show the examples. Nobody should ever use that in a more complex setup.

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

    Could you explain, how is possible using arithmetic operation directly on the object, if C standard does not support any operator overloading, and here definitely plus operator need to be implemented somehow, like it is in C++ ? I was always very curious about it how they overcome this for complex numbers making some breaking out from the C standard (i mean the operators for complex types). Thanks. !

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

      You could define a macro e.g. ADD(a, b), check if arguments are of type complex and perform object specific arithmetics

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

      I have no clue how the complex numbers work under the hood but it would be a very interesting topic to dive into.
      My guess is that they have their own binary format and they set it up so that regular addition works on them..

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

    Can you explain how programming a codec on C ?

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

      Hmm, I've never done that but I assume that's a *very* broad topic.
      Probably similar to decoding a binary file but there is a ton of formats and they all look quite complex (for video at least)

  • @yourfriend9503
    @yourfriend9503 5 місяців тому

    Please Can you do a tutorial course kn advanced cpp?

    • @cacharle
      @cacharle  5 місяців тому +1

      It's in my plans but no promises :D

    • @yourfriend9503
      @yourfriend9503 5 місяців тому +1

      @@cacharle This is enough for me.

  • @alejandrogabrielruiz
    @alejandrogabrielruiz 6 місяців тому

    Nice !,,tks,,😊

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

    Never used complex stuff after fract'ol tbh :D

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

      Ye, I mainly used it to prototype fractals too
      but using naitive complex numbers for stuff that needs to be performant won't quite work unfortunately :D