Prime Reacts: Is This NEW Language BETTER Than Rust? C++? (Zig First Impressions)

Поділитися
Вставка
  • Опубліковано 22 лют 2023
  • Recorded live on twitch, GET IN
    / theprimeagen
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
  • Наука та технологія

КОМЕНТАРІ • 706

  • @ThePrimeTimeagen
    @ThePrimeTimeagen  Рік тому +81

    GO SUB TO LLL!!!
    Original: ua-cam.com/video/zFELcHTki9U/v-deo.html
    Author: www.youtube.com/@LowLevelLearning

    • @LowLevelLearning
      @LowLevelLearning Рік тому +13

    • @LoftwahTheBeatsmiff
      @LoftwahTheBeatsmiff Рік тому +1

      Subbed cheers

    • @RogerBarraud
      @RogerBarraud Рік тому

      Already was 🙂

    • @alienews0
      @alienews0 Місяць тому

      1:00 might be possible that your editor does weird sh*t if it wasn't coded in the best language ever : c++
      No ok seriously i know rust is better but stop hurting old guys' (like me) feelings : when i studied coding, cpp was the best language around.

  • @theondono
    @theondono Рік тому +831

    No beeping while saying “C*+”? I thought this was a family friendly channel..

    • @soulofangel1990
      @soulofangel1990 Рік тому +49

      yeah, that was a C*+ move from the Primeagen

    • @KeyError
      @KeyError Рік тому +11

      C*+? … oh no I made it worse

    • @samanthaqiu3416
      @samanthaqiu3416 Рік тому

      fuck you and wait for it..
      no beep, huh

    • @CoreDump451
      @CoreDump451 Рік тому +9

      I for one am shocked.

    • @guitarcat01
      @guitarcat01 8 місяців тому +5

      Why would he say C pointer plus?

  • @costelinha1867
    @costelinha1867 Рік тому +503

    I'm still waiting for someone to make a language called Zag, so the cycle becomes complete.

    • @eshwarprasad524
      @eshwarprasad524 Рік тому +147

      Zig for Backend
      Zag for Frontend

    • @nicowong2428
      @nicowong2428 Рік тому +63

      @@eshwarprasad524 dude i would switch to full-stack if we got this.

    • @LoveLearnShareGrow
      @LoveLearnShareGrow Рік тому +13

      I WANNA REALLY REALLY REALLY WANNA ZIG A ZIG - AH!

    • @drh374
      @drh374 Рік тому +1

      😂

    • @RenderingUser
      @RenderingUser Рік тому +15

      if that isnt the name of the upcoming package manager for zig, i aint using the language

  • @AK-vx4dy
    @AK-vx4dy Рік тому +108

    Zig is clearly to replace simple pure C on embedded systems or DIY projects. It's clearly safer so less frustrating to beginner.

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

      no. at least to the first. While it is fine in embedded systems and DIY projects, its clearly meant for general purpose usage. Also, pure c? Vs what? Mixed language projects?

    • @AK-vx4dy
      @AK-vx4dy 9 місяців тому +7

      @@homelessrobot I wanted to say that Zig is not 1:1 C++ replacement.

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

      @@AK-vx4dy OK, i see.

    • @AK-vx4dy
      @AK-vx4dy 3 місяці тому +1

      @@SimonWoodburyForget Right. But Rust let you build guard rails for entire teams even in lowlevel language.

    • @TheSulross
      @TheSulross 19 днів тому +1

      But what can you say about a dude that rattles off Carbon - passing it off as though its a viable choice for today's professional working programmers?
      Carbon is years away from reaching that kind of viable mainstream status.
      From the get go I visibly watched as the analog credibility meter flatlined as soon as the AI engine parsed and analized that sentence.
      It even activated the seldom-heard Star Trek red alert alarm. Had to enter that special code that is normally only used to stand down ready-to-launch ICBMs to get that alarm turned off.

  • @anderdrache8504
    @anderdrache8504 Рік тому +314

    I also prefer Rust over Zig but I think it's very interesting, so to address some of your concerns:
    - Zig will get a Package Manager and the Lead Developer Andrew Kelley was live streaming development on it just a few days ago
    - Zig is null safe, pointers can't be null by default and nullable types have to be null-checked before you can use them (almost the same as Rust Options)
    - You agreed on "no hidden control flow", but once you realize that this means that Zig doesn't have destructors, you might disagree :)
    - Don't be too mad about undefined, it just means "uninitialized" and will be caught when used incorrectly in debug builds (Rust also has this with mem::uninitialized)
    - Zig basically has Rust-like enums with union(enum), they work almost exactly the same and you will have to switch on them to access the data like in Rust
    Overall I think that Rust has many more use cases but we shouldn't say that it will "win", since Zig also has it's niche and it's a very interesting language.

    • @diadetediotedio6918
      @diadetediotedio6918 Рік тому +27

      Rust still wins in the sense that the entire construct of the borrow checker is also to prevent many problems related to racing conditions and memory leaks, in Zig you just can't have many of these guarantees. But surely, Zig is indeed an interesting language, I just hope it's fanbase didn't turn into another C++-like toxic community

    • @ScibbieGames
      @ScibbieGames Рік тому +63

      @@diadetediotedio6918 The borrow checker simply does not work in low level environments and graphics programming. Undefined behavior is all over the place in the embedded space. By giving those guarantees, it makes it harder and very difficult to interact with the C ABI at all.

    • @fiona9891
      @fiona9891 Рік тому +13

      @@ScibbieGames an argument for using both of them in different situations.

    • @diadetediotedio6918
      @diadetediotedio6918 Рік тому

      @@ScibbieGames
      This is simply a lie, take a look on Asahi Lina commentaries on Rust utilities for driver development for an interesting example

    • @erickmoya1401
      @erickmoya1401 Рік тому +3

      Handling memory correctly without handling it is what makes it great from the beginning for me. If someone copies it and improves in other things I am in.

  • @StingSting844
    @StingSting844 Рік тому +34

    The dog itching sound was so funny 😁
    Btw one of the most hyped projects written in Zig is Bun by Jared Sumner and when i tried it the first time I got a segmentation fault 🤷‍♂️

  • @Jplaysterraria
    @Jplaysterraria Рік тому +73

    I wouldn't say Rust was easy to learn for me, but it made sense:
    I came to Rust with mostly C/Java/Python knowledge and I kept struggling with mutability in Java/Python, and C just being hard to get right/having to reimplement basic data structures all the time.
    With that background, I wanted something that dealt better with mutability than Java/Python, and something which wasn't as involved as C/C++ to get dependecies working, for that, Rust is the perfect midpoint (even though it's closer to C/C++ than Java/Python).

    • @ghosthunter0950
      @ghosthunter0950 Рік тому +2

      With c specifically I just keep important pieces of my previous code around to reuse in different programs like data structures, and you gain knowledge and experience implementing them at least once in your life, although it's not that necessary I still like it.

    • @Jplaysterraria
      @Jplaysterraria Рік тому +13

      @@ghosthunter0950 I do implement data structures for fun, but I'd rather use a battle tested data structure than whatever I come up with for actual code.

    • @radinkhosraviani8634
      @radinkhosraviani8634 Рік тому +1

      Have you tried golang? I’m tearing myself apart on what to learn. I only know the basics of python and basics of javascript

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

      @@radinkhosraviani8634 learning go isn't a bad move, largely because it's a pretty small investment compared to something like rust or C++. It's easy to get productive quickly. It'd probably be a good place for you to start with statically typed languages.

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

      @@Jplaysterraria this however doesn't suggest that its the language's job to make this possible. There are plenty of data structure libraries for c. Use one.

  • @wWvwvV
    @wWvwvV Рік тому +1

    I use unit tests to speed up development. The round trip to develop something is much faster in a unit test. 13:29 a well known golang library for testing is 'testify'. It has the assert functionality. It also has a require functionality, which will stop the whole test run because of preconditions. Assert continues to collect more test fails.

  • @vishwanathbondugula4593
    @vishwanathbondugula4593 5 місяців тому +3

    You can avoid segfaults by not adding \0 by just initializing your buffer to \0s initially (using something like bzero or my fav memset(buf, '\0', sizeof(buff))) and then once you copy your chars to that array / buffer you don't have to explicitly put a \0 at then end since the memory is already filled with \0s and you are overwriting them with whatever you want given you don't overflow the buffer.

  • @rogerdeutsch5883
    @rogerdeutsch5883 2 місяці тому +1

    Fantastic rant about try/catch (exception handling is actually goto structure - error occurs and execution jumps to "unknown" location). Also, really like the mantra "errors add value".

    • @TheSulross
      @TheSulross 19 днів тому

      Using modern C++ I disable exceptions and use a template class based on std::variant for function return type - so a return is either the desired value or an error. Thus the coding style for error handling is much like Go. I also have a template that I call defer - it is constructed with a lambda.
      I use defer for RIAA cleanup of things like file descriptors, sockets, database connections - things that are not simple memory-only objects.
      So here too the coding resembles Go.
      And I uses std::span for passing anything that is array-like and std::string_view for span of string chars. Passing all array-like things via std::span means can use all the memory safe operations found on std::vector such as iterators and, say, range-based for loops. Can trivillaly use std::for_each, the algoritms, the new range-based feature of C++20, etc. (std::span doesn't get enough press to highlight what a game changer it is for writing safer and very versatile code that is still most efficient).
      If I then need to pass a string to an API that expects a null terminated C string then just use strndupa() to make a bounds safe copy of the string_view span that is null terminated and entirely existent on the stack, and pass that string to said API - but all the APIs that I write take std::string_view.. (I do hi-perf networking and it's an absolute no-no to touch the malloc heap when executing the data plane code paths. Using the heap is only permissible on control plane execution paths.)
      So do these things with modern C++ and life is very civilized - most hygienic, so to speak.
      The fact that C++ can directly consume C headers and directly interact with C is actually its super power - depite how much it gets flamed for being its legacy ball-and-chain.
      I'd say that Zig would be the definite better alternative for my domain use case than Rust would be. But modern C++ is just nailing things so well that there's just no compelling incentive for switching (let alone the cost and timeline of rewrite factors).
      The one annoyance is sprinkling noexcept on all the function declarations, but can certainly live with that. And if ever forget to add noexcept, well that's not a foot gun.
      Yeah, throwing exceptions was a dead end. We should all just repent and strive to be better people after acknowledging the error of our ways.

  • @davidandrewthomas
    @davidandrewthomas Рік тому +14

    Zig vectors are vectors like vec3 and vec4, used for easy SIMD. The growable array is a std.ArrayList 🎉

  • @minikame2272
    @minikame2272 Рік тому +58

    Prime: "I'm tired, need a small rest."
    *Spends the next week publishing more videos than there are days.*
    Go to the Bahamas without your laptop or something or imma break in and shave your face in your sleep

    • @rodrigolj
      @rodrigolj Рік тому +5

      >implying he sleeps

    • @seancpp
      @seancpp Рік тому

      He livestreams then an editor goes in and chops out individual videos from it

    • @Hardcore_Remixer
      @Hardcore_Remixer 2 місяці тому

      You got a Segfault when you dereferenced his unallocated sleep variable.

    • @Kane0123
      @Kane0123 Місяць тому

      This is such an interesting mix of anger and loving sentiment.

    • @TheSulross
      @TheSulross 19 днів тому

      it's essential to ditch the smart phone to have anything resembling a true vacation break
      people should just go to Walmart and get a $30 simple, calls/sms-only burner phone - then only allow significant others to have its phone number, and take only that phone on vacations.

  • @eagle2com
    @eagle2com Рік тому +13

    A vector in Zig is actually a type intended for SIMD operations, not a dynamic array.

    • @TheSulross
      @TheSulross 19 днів тому

      I have this program that built for a large telcom company that uses the Intel DPDK library to replace the kernel networking stack and takes over complete management of a specified ethernet interface. DPDK is written entirely in C.
      DPDK also isvrather primitive in that one works with it by reading and writing entire raw packet via RX/TX port. There is no high level Berkley networking stack sitting atop that (though there are projects that graft such on). In my case I justbneed to support UDP transport but I still wanted a socket abstraction for dealing with different traffic sessions, so I heavily modified the UDPDK library to provide that - it too is all C.
      So everyone is familiar with Linux epoll vs POSIX poll. I needed to add such an API to UDPDK.
      Well, epoll is superior to poll and can scale to tens of thousands - perhaps overbhundred thousand concurrent socket sessions. The poll API tops out at level of a thousand to few thousand sessions. epoll is probably at least ten times more efficient if not more.
      However, implementing epoll is complex - implementing poll is simple. Naturally I implemented POSIX poll.
      The performance is good to up to a thousand and perhaps acceptable to around 4 thousand. This is considered okay as get a huge boost in network traffic throughput from DPDK. And this will be deployed in K8 and sonwill be load balanced clustered - need more session capacity then launch another container instance.
      But if I redesign the poll call data structure to be data oriented - like Zig does its containers, and use SIMD to do the poll processing, I would automatically make the scaling of my poll API 8 times greater. Scaling to 20 to 30 thousand concurrent socket-based traffic sessions would be a wonderful win.
      There is even talk of support for SIMD in C++ 26
      But gcc has intrinsics for doing this too - which will be what I use. But a language that could directly support this would be kind of cool.

  • @a_commenter
    @a_commenter Рік тому +2

    12:30 My main rule for unit tests is that I'll write them if, when writing a function, I go "wait will this be an off-by-one error?"

  • @n4bb12
    @n4bb12 Рік тому +20

    I love unit testing, it saves me so much time.

  • @giorgos-4515
    @giorgos-4515 Рік тому +2

    the exception thing sounds like something typescript could handle, like in java with the "throws Exception" and then force you to handle it

  • @thfsilvab
    @thfsilvab Рік тому +42

    The test declaration syntax is just beautiful, would love something like that in Rust instead of marking everything with attributes, also having test names as strings, just gorgeous

    • @inkryption3386
      @inkryption3386 Рік тому +1

      You can also use local declarations in place of a string, to signal you're specifically testing it. E.g.
      fn parseInt(bytes: []const u8) u32 {...}
      test parseInt {
      // -- test the function --
      }
      which is really nice

    • @stevenhe3462
      @stevenhe3462 Рік тому

      Elixir also has this, but it's a macro.

  • @frydac
    @frydac Рік тому +11

    I've done a lot of C and I try to use it as little as possible. The thing is that you only use C where you absolutely have to. 2 such usecases are languague interop (zig can maybe be used here if it also is compatible with the C ABI, I don't know), and embedded platforms that only have a gcc based compiler that only supports C properly. Which is the biggest usecase for me and thus zig will probably never do that, and I think it will take some time before those platforms don't exist anymore and everything supports llvm based compilers. So in those usecases zig is just not competing and C remains the only viable option, and in the other usecases it is competing with C++ and Rust and imho not really with C, and then I don't really see it gain a lot of traction, but who knows.

    • @Sindrijo
      @Sindrijo Рік тому +4

      One of the primary use cases for Zig is exporting a library with the C ABI for other programming languages to call into.

  •  Рік тому +6

    Unit testing is good where it's needed. Mainly, on medium to high level functionality.

  • @Re4mstr
    @Re4mstr 11 місяців тому +1

    You, my man, are peak entertainment.
    Please keep making videos.

  • @blenderpanzi
    @blenderpanzi Рік тому +12

    libc is bloated? I just looked it up, yes under Linux Zig directly does sys calls without libc! But most other programming languages (like Rust) still link libc as a kind of system call abstraction layer. libc is a really small standard library. It doesn't even provide a hash table (unless that changed recently). Software bloat comes from shipping a full browser engine with your software (Electron), not from linking libc!

    • @TheSulross
      @TheSulross 19 днів тому

      the nasty thing about clib is that the C APIs it defines are versioned even at a linker level. So it's incredibly easy to write a program that binds with libc, using a latest compiler and latest Linux distro, then find your program won't run on other distros that are just a matter of a fewvyears old - even though there is no semantic change that would break the working of your program, and at the C language level the API signatures remain exactly the same.
      It's way overly tedious to try and work around this libc versioning crap.
      One thing I appreciate about Go is that there is a like ability to build a Go program to where it doesn't bind to libc at all.
      If it was easy to opt out of the stringent version binding on libc APIs I wouldn't mind it, but it's a too much of a mess to cope with.

    • @blenderpanzi
      @blenderpanzi 19 днів тому

      @@TheSulross That's true and was actually a reason why I linked an otherwise standalone (Rust!) binary with musl instead of glibc once. But that's a glibc issue, not a general libc issue. But granted, it's effectively the same. Though I wouldn't call it a bloat issue, but a versioning issue. But that's now splitting hairs.

  • @prgnify
    @prgnify Рік тому +68

    I have some input on the "first language to learn" thing. I think Prime gets the point perfectly, if Rust is your first language, you learn it once and learn it right - all while the language itself teaches you - the rust compiler not only teaches you the language but also teaches you programming as a whole.

    • @andrewdunbar828
      @andrewdunbar828 Рік тому +46

      There's a lot more chance you'll give up on programming though when you're new and only see a huge wall and the benefits are only going to be visible after you scale the wall. I've seen people give up on easier languages who I know would be able to program.

    • @Evan490BC
      @Evan490BC Рік тому +21

      I like Rust. But it doesn't teach you "programming as a whole". It teaches you imperative programming with a dash of functional.

    • @Zubbbz
      @Zubbbz Рік тому

      This has 100% been my experience while learning programming. Most of my knowledge has been learned while I have been learning rust and it actually tells you the issue which is so nice.

    • @jordixboy
      @jordixboy 9 місяців тому +3

      @@andrewdunbar828everyone is able to program with enough time and effort put in. Programming is nothing special and you dont need to be a genius for it. Its just effort and time, like anything really.

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

      @@andrewdunbar828 I don't think the wall is anywhere near as huge as that for C++. I learned C++ as a kid and struggled with it for years; its surface area is insanely massive with difficulties everywhere, for any newcomer. I strongly believe I would have had a far easier time learning Rust had it been as mature as it is now back then. It's built around the same principle, lifetime-based resource management, but is the conceptually simpler language by far, with an easier ecosystem of tools and packages to use.

  • @IanRiley915
    @IanRiley915 Рік тому +14

    I really enjoyed these takes. I'm an instructor who teaches programming, algorithms, data structures, etc. to high school and college students. I've given Rust serious consideration time and time again as a first language for these students. I also go back and forth on the issue. You have many separate camps, which makes it a difficult question. You have students ages 12-18, students ages 18+, and those that are self-taught at home of various ages. The question of what to learn first or even second heavily depends on which camp you're in and also what country you live in. For students, Rust could be a good first or second language. At least at this time, Zig would not be. I could see a language like Zig in the future with the same philosophies being a good candidate for teaching programming to students, but as it stands right now, it's maybe a third language, maybe.

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

      I would say that Rust is a great language for newbies. I say this after I have struggled with C (and it's variants for decades). Rust forces you to think about Data, who owns it and who can borrow it. There is additional thought about Rust that you need, instead of code and debug, refactor and debug. Sure debugging is a fact of life, however I want to feel like I'm learning something and the Rust Analyser and Cargo Checker do a great job. If you ask a Python programmer what is the Heap, they may look at you and blink, with Rust you learn more about what's going on under the hood, just by declaring a variable for an integer addition. I like the fact that you deploy rust on Microcontrollers (that anyone can buy and play with) and they also create Web interfaces with it. I think it will be the swiss-army knife of programming. I've heard that Zig is the C replacement and Rust is the Cpp replacement, but I don't know.

    • @Yupppi
      @Yupppi 5 місяців тому +3

      Rust would be cool if the teacher was really focused on individual support and explained things really well, because it feels like a tough language where you really need to know quite a few "whys" to get things come right when you write it. It's not forgiving and it drives me mad when it feels like every implementation has different syntax rules to compile, any detail you change breaks it until you figure out that the rules have changed. But then again, with good teaching it might work nicely, especially if the student didn't have experience that directs them to wrong conclusions. That in my opinion is equally difficult about Rust like Primeagen said too.

  • @UliTroyo
    @UliTroyo Рік тому +22

    I love Zig, and I think it’s one of those things where you either gravitate toward it or Rust.

    • @Gordolone
      @Gordolone Рік тому +3

      Totally agree. I really love Zig. I feel more comfortable with it than Rust. But this preference does not mean Rust is shit for me. I like seeing Rust used but I don’t like using it in first person 😅

    • @PwrXenon
      @PwrXenon Рік тому +4

      I’d pick rust, zig feel like some offshoot c replacement

    • @etodemerzel2627
      @etodemerzel2627 Рік тому +7

      Zig is really nice to use. Very simple and straightforward, yet very powerful.

    • @PwrXenon
      @PwrXenon Рік тому +5

      @@etodemerzel2627 I don't doubt that, its just that If i'm going to invest my time into a language it needs to have some staying power, C isn't going anywhere but rust will with time take over C++'s edge and has been growing alot and devs love it.

    • @andrewdunbar828
      @andrewdunbar828 Рік тому +1

      I like Zig and Rust, but I'm not actually productive these days so maybe that's moot. I have noticed a few other people who like both though and they tend to be the types that are not language fanboys and are not prone to attacks and hyperbole, etc.

  • @user-tw7tn2hq9u
    @user-tw7tn2hq9u Рік тому +2

    I think it is quite not so easy for beginners compare to C/C++ where you can dip into lang smoothly step by step. Console print function is not so intuitive at first, and Heap allocating is also require understanding of std library. But for professionals aiming for full control it would be a good choice (after release of 1.0)

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

    13:23 “I don’t do red-green-refactor”. I take very similar stance to Prime on testing for the most part, but probably lean a little more on the fewer tests side. One thing I do, which might be different than what is being referenced here, is when a nasty bug comes up that I want to guard against regressing is to write a test that fails before fixing it (which then passes). There have been far too many times when I either think I’ve fixed a bug but actually didn’t, or had a regression but lost context on how it was fixed before (b/c the code has changed too much that git directly before/after the fix doesn’t show how to fix it NOW) that this is non-negotiable for me. Maybe this has a different name

  • @VACatholic
    @VACatholic Рік тому +10

    Prime should do a review of Eskil Steenberg's projects in C. Would be interesting.

    • @explqicot3293
      @explqicot3293 Рік тому

      I know he streams on twitch but do those streams get posted somewhere ?

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

    Try Catch2 for c++ testing. Super lightweight, one header. Not crazy amounts of overhead syntax.

  • @alexey104
    @alexey104 Рік тому +2

    2:10 > "If this function throws, which function is going to catch it above you?"
    But if this function just fails returning some error code, which function is going to handle it, if any at all?

    • @AloisMahdal
      @AloisMahdal 2 місяці тому

      I had a similar thought about that part.
      I think Zig's model is still better, though, because you can't start throwing errors without obviously changing the signature of the function. If a function returns error, caller simply must deal with it, if only to pass it on. And compiler's going to know which errors could be returned from a given function so it can track it for you and make you deal with it at some moment. I think you can do similar things with try/catch handling but in Zig it's just cleaner, all is there in plain sight.

  • @jamesl5149
    @jamesl5149 Рік тому

    The only time I use TDD is when designing an APi. I find it easier to visualize how an API should work by actually writing the client code first.

  • @samhughes1747
    @samhughes1747 Рік тому +1

    Your thought at 23:56? THIS! This is what bit me hard going into Rust. Learning it was like a bootcamp in the "break you down, destroy your understanding of the world, and recreate you brick-by-brick" sense. It took a while, but it had to unlearn a bunch of bad ideas I picked up from various dynamic languages. Fantastic observation.

    • @fulconandroadcone9488
      @fulconandroadcone9488 Рік тому +2

      I beleave any scripting language used to create anything more than 100 lines such as bash scripts is a bad idea.

    • @samhughes1747
      @samhughes1747 Рік тому

      @@fulconandroadcone9488, what's a "scripting language" :p. Try to answer without describing dynamic/hosted languages.

  • @jakejakeboom
    @jakejakeboom 9 місяців тому +8

    libc is optional, if you’re doing embedded programming in C then you should know exactly what you’re linking in, what your trap table looks like, your entry point, and everything that happens in your boot loader to set up your stack and whatnot. These things are not inherent to C, and they are pretty much all configurable. I don’t see how Zig would be any different, but I’m happy to be corrected.

    • @TheSulross
      @TheSulross 19 днів тому

      and even doing Linux specific programming, libc is a huge pain in the arse because of it's versioning of its APIs. What one builds on a late model distro, binding to its versions, can then end up not being able to run on customer distros that are just a few years old (Canonical sells pro support for LTS releases that can go out to 12 years).
      It's a pain to try and opt out of that and buildvreleases thatbare capable of running on older releases while doing so using the latest in distros and compiler releases.
      Zig has taken on a righteous battle indeed in attempting to solve the infamous libc problem.
      Linux libc tyranny is straight from the pits of Hell.

  • @hrgdavor
    @hrgdavor Рік тому +1

    Not all errors are recoverable, so I would argue that there is place for checked and unchecked errors. Old days when Hibernate throwed checked operations from every method (any sql query could fail do to loss of connection) .... was a living hell.

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

    Apparently C++ is why, but the guy who picked the name "vector" didn't realize what it meant in math.
    And now everyone does it.

    • @testtest-qm7cj
      @testtest-qm7cj 3 місяці тому

      Scheme, Common Lisp -> C++, Java -> everyone else

    • @QberryShortcake
      @QberryShortcake 3 місяці тому

      @@testtest-qm7cj what

    • @testtest-qm7cj
      @testtest-qm7cj 3 місяці тому +3

      @@QberryShortcake Alexander Stepanov and Daniel Rose, "From Mathematics to Generic Programming"
      The name vector in STL was taken from the earlier programming languages Scheme and Common Lisp.

    • @Pabloparsil
      @Pabloparsil Місяць тому

      In Zig I think they just run out of names. They have arrays, arrayList and wanted something for the SIMD stuff and had to go with Vector

    • @QberryShortcake
      @QberryShortcake Місяць тому +1

      @@PabloparsilVector for SIMD actually makes sense to me

  • @zebastianjohanzen3865
    @zebastianjohanzen3865 2 місяці тому

    My old man started programming on a Burroughs mainframe in the 1970s. Yes they literally wrote their programs on paper! The handwritten program would be given to a typist who would type it out onto punch cards. It would then be given to a second typist who would put the punch card machine and verify mode and retype the program. Then they would get the punch cards back and look through them to find the remaining errors. Then they would send it to be compiled, and they would get the compile errors the next morning.... The process repeats.

  • @vladimirbauer6604
    @vladimirbauer6604 Рік тому +2

    Actually rust's macros are capable of introducing hidden flow control. For example "bail" and "ensure" macros from anyhow crate return implicitly. It's hidden control flow, they hide return keyword, which is imo bad.

  • @raph151515
    @raph151515 Рік тому +1

    try catch are magical when you get some levels of recursion/calls/loops and you need to break to many levels up in the stack, nothing can beat this

    • @etodemerzel2627
      @etodemerzel2627 Рік тому +3

      Zig has labeled loops, so you can break out of any loop you want.

    • @beefbroccoli5489
      @beefbroccoli5489 Рік тому +4

      magic is the right word, but voodoo might be even more accurate.

  • @onerimeuse
    @onerimeuse Рік тому +3

    Jeeeeesus, for a programming channel this is iiiiintense... Love the energy. Keep on!

  • @aakarshan4644
    @aakarshan4644 Рік тому

    hey prime would love if you made a video on "We Need to Discuss the Microservices Madness - Scaling with Common Sense" by hussien :) or maybe the blog he reads in that.

  • @TheKahiron
    @TheKahiron 2 місяці тому

    As an embedded C dev, I've been wanting a C with fewer "implementation defined", and some sensible quality-of-life ADA features - Zig looks very promising. Packed data types like Zig's may not be as pretty as the ADA type syntax, but it's still looking grand for mapping up register bit fields.

  • @davidandrewthomas
    @davidandrewthomas Рік тому +31

    I think when you are actually doing systems programming, Zig the language is better than Rust the language. A large part of that is the allocator story, and another large part of that is how difficult it is to write correct unsafe Rust. Zig is also really compelling for working with C and incrementally updating a C codebase.
    I think the Rust community does not spend nearly enough effort on making unsafe Rust safer in practice, to help people write correct safe abstractions. The Rust allocator story is pretty awful for many systems language use cases too. I think Zig succeeds on both of these fronts
    On the other hand, Zig has a whole lot of catching up to do with the tool chain and third party library ecosystem.

    • @geeksuperstar8564
      @geeksuperstar8564 Рік тому

      Odin is more simple and lots of options for custom allocators.

    • @vladlu6362
      @vladlu6362 Рік тому +6

      Next rust release is focused on improving unsafe rust. Release 2024 will make all the safe rust features be also available for unsafe rust constructs. It will be better enough to compete.

    • @vladlu6362
      @vladlu6362 Рік тому +1

      Allocators are very, VERY OS dependant. Even architecture dependent. Rust simply does not include it's allocator for embedded applications, and you must implement one for your device.
      Rust was not made around supporting C, unlike Zig. So yes, rust does prefer full rewrites, but I wouldn't say that it is a bad Idea.

    • @geeksuperstar8564
      @geeksuperstar8564 Рік тому +1

      Unsafe Rust is like a language inside a language. It was such a dumb decision. Unsafe Rust is anti-rust 100%

  • @davidbriggs8109
    @davidbriggs8109 Рік тому +1

    Yo, where do you get your energy from and your jokes😂😂😂😂 your good

  • @danielcoats713
    @danielcoats713 Рік тому +5

    As a C# programmer, off the rip the sentiments expressed after hearing "no hidden control flow" is felt. That's actually the main reason why I suggest Rust to C# programmers.

  • @keithrobinson2016
    @keithrobinson2016 3 місяці тому

    Try Odin. With all the bundled libraries, getting things moving around the screen is really easy and setting up Odin in the first place is easy. Great place for beginners to start.

  • @trondenver5017
    @trondenver5017 Рік тому +6

    This video was very enjoyable. Thanks.

  • @SamualN
    @SamualN Рік тому +8

    prime should do a stream with andrew kelley like he did with rich harris

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

    I have no idea if this is best, but 30+ years ago when I learned programming at first, I learned BASIC. I didn't learn about things like loops and function calls, those were things I had to make on my own. Then when I went into undergrad and learned about them, it felt like cheating... BUT I also knew how they were working "under the hood." So I think a good way to learn the basics is to learn how they work in implementation, even if you don't necessarily build a whole project that way.
    My kids are interested in learning programming and I'm struggling with the best way to teach them. I think the best way is to start with just very simply, here's what a computer is: a processor and memory. Instructions are stored in memory sequentially, and the processor just executes those instructions in order, and here's what those instructions look like (a la BASIC). From that basis, then we can build in the concepts of loops and function calls, then data structures, etc.
    I don't know though. I don't know the best way. Maybe Harvard CS50 is best?

  • @rumplstiltztinkerstein
    @rumplstiltztinkerstein Рік тому +53

    I think that "Rust is a hard language" is not the best way to describe the experience with it. I would think that the best way to describe it, to someone that haven't used it, is that "Rust is a language that is slower to implement". The language requires us to focus on way more details than other languages. We have to think about the way memory is managed. We have to think about the compiler.
    Ownership, pointers, traits and generics. That is rough to get started. I think that new developers should be given the option: "Do you want to learn a language that will allow you to spend a short time coding and a long time debugging, or a language that takes a long time coding and almost no time debugging?"

    • @AlexanderHyll
      @AlexanderHyll Рік тому +12

      With respect to everyones opinion and this being to some degree subjective, I don’t agree that Rust is slower to implement after you know it well, but is indeed harder to learn to that extent as a programmer. The Rust language is generally not more verbose than other systems programming languages, but it takes longer to get to the point that you write code that just compiles first try. At least that’s my 2 cents after 4 years professionally coding in rust. Rust has more concepts you need to master than most programming languages, but really isnt that slow to implement 98% of the time (ofc comparing to C(with variants)/Java etc).

    • @rumplstiltztinkerstein
      @rumplstiltztinkerstein Рік тому +2

      @@AlexanderHyll I kind of agree with your point. But I have trouble when it comes to learning new crates. Sometimes we have to go deep into the type system to find out what returns what. It gets a lot easier with practice, but messing around with the type system can be rough.

    • @khhnator
      @khhnator Рік тому +2

      rust is complex, it is declarative by design. it won't wipe your ass, you have to ask for it
      its slow language to master just because there is much to learn
      the time you spend to get the first build of your program that does "something" even if not properly. is slower than other languages. a lot slower in fact.
      but time to deliver a program however is faster than comparable languages. a LOT faster. just because there is less debugging time. and usually ends with something that at least feels a lot more reliable.
      and that seems like that's why everyone ends loving rust. there is that period when you are halfway thru development when each new problem that emerges seems to get worse than the previous one. and you feel like just tossing the whole codebase in the garbage and starting again.
      while in rust the experience is the opposite, not only you have less problems in general as most things **just works** even against our best intuition while the complexity of the issues don't escalate.

    • @MrTeathyme
      @MrTeathyme Рік тому +3

      rust is insanely fast to implement once youve learned it
      Almost all the features of the borrow checker that slow you down can be bypassed.
      Need to quickly whip up something and dont want to have to deal with keeping track of mutable references etc? .clone() everywhere, itl run like ass and its unclean as fuck, but if youre whipping something up quickly as a PoC you dont care about that anyway.
      Thats ownership dealt with.
      Traits you straight up dont even need to touch for 80% of what you can do in rust, you only really start touching traits as an implementation detail, which again isnt relevant for PoC's
      Generics are the same story as traits, when youre in rapid development "Do it wrong but do it fast" you can just code with explicit types, after youve already nailed the PoC you can always come back in and coalesce the code down using generics to remove duplication.
      As for pointers, I dont really touch pointers in rust I havnt found a scenario yet where I actually need to use pointers instead of references.
      Rust is just as fast as any other language to prototype a PoC
      its slower to implement the final prod version, but thats because youre expected to actually code it properly instead of taking shortcuts which you SHOULD already be aiming for for a prod release, quick hacky code is purely in the realm of PoC's and should never be shipped, shipping that shit is just asking for technical debt.

    • @rumplstiltztinkerstein
      @rumplstiltztinkerstein Рік тому

      @@MrTeathyme good point

  • @dyslexicsteak897
    @dyslexicsteak897 Рік тому +13

    Zig is an ultra mini ultra simple ultra clear language and I don't think it can even be compared.

    • @geeksuperstar8564
      @geeksuperstar8564 Рік тому

      Odin is simpler and clearer than Zig

    • @lugaidster
      @lugaidster 29 днів тому

      ​@@geeksuperstar8564to me you can only call a programming language "system's programming language" of it supports freestanding targets.

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

    functions not having what it throws in the signature is also one of the biggest problems in C++. Yeah you do have noexcept there but almost no one actually uses that correctly and it's basically only in code documentation and doesn't actually enforce anything

  • @felixallistar
    @felixallistar 2 місяці тому

    17:00 AWESOME thank you. ive been wondering if i was right in picking C for that reason over zig and looks like i wasn't entirely dumb atleast

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

    2:35 so relatable I had to check which function is gona catch and stuff , error handling gets ugly

  • @stuff4232
    @stuff4232 Рік тому

    hidden control flow is cool for anti debugging techniques and anti analysis. Cool stuff

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

    i'm conflicted between zig and odin. and my only problem with odin seems to be semantic.
    having to type some_module.method( object, args...) somehow annoys me when i should be able to type object.method(args...)

  • @FlaviusAspra
    @FlaviusAspra Рік тому +1

    I agree with having to go through C, but I don't think it's "just so you can have the experience". I think it changes your mindset, you learn to pay attention yourself to details (the compiler and the C runtime won't).
    I would argue every new type of programming makes you a better programmer in all languages.

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

    Am I the only one when heard "below the C-level" joke had a one specific tune play in my head that goes along with the lyrics "arrrre you rrready kids? aye-aye captain!"

  • @mario7501
    @mario7501 Рік тому +48

    I would say C should be the first language for most people. Especially if you do a CS degree. It just teaches you so much about how computers work and you'll appreciate why rust's borrow checker is so amazing.

    • @waldtrautwald8499
      @waldtrautwald8499 Рік тому +29

      While I do agree that every programmer should learn C at some point, I don't think it's a great first language. As a beginner, thinking algorithmically is already hard enough. Adding all the complications a low-level language like C brings doesn't lead to a great learning experience imo.

    • @shimadabr
      @shimadabr Рік тому +4

      ​@@waldtrautwald8499 That's the thing though. It depends on what you want to learn. For a CS student, C brings a lot of value because it teaches a lot about low-level aspects of the computer. What better moment to learn it than at that moment? It's useful when learning operating systems, networks, computer graphics, etc. But it's true that when you're studying these subjects, including data structures and Algorithms it can be an obstacle to manage it's dirty aspects while trying to learn the fundamentals of what you're studying.
      As for a self-taught developer/student it's better to start with something more "tangible" imo. Because you want to enter the market as fast as possible and trying to understand all the aspects of computing that C can help expose is time consuming.

    • @0xDEAD_Inside
      @0xDEAD_Inside Рік тому +7

      During my final exams in college, a girl beside me literally cried with head on the desk because she got segfault in her linked list implementation and she couldn't find the source.

    • @shimadabr
      @shimadabr Рік тому +4

      @@0xDEAD_Inside lol that's a little extreme 😂. I imagine she was unded a lot of stress and this was the final straw.

    • @0xDEAD_Inside
      @0xDEAD_Inside Рік тому +3

      @@shimadabr Yeah! She was a straight A student and segfaults are back breakers even for experienced programmers.

  • @modestas3d391
    @modestas3d391 Місяць тому

    Testing after writing the code is kind of a thing I hear many people doing. Not that the TDD is bad or hard, but still kind of a preference thing.

  • @Jankoekepannekoek
    @Jankoekepannekoek Рік тому +1

    Yes, that's exactly how zig does errors; you can declare error sets, which are effectively sum types.

  • @Iscream4j0y
    @Iscream4j0y 2 місяці тому

    I test things to make sure they work the way I think they do, like I write code, and I write my tests to make sure it works specifically the way I wrote it, I attempt to strongly type all the values, and I write counter tests to make sure that it's not returning results when it shouldn't. I've been so tired of thinking that it works the way I intended and instead KNOW that it works the way I intended

  • @Dygear
    @Dygear Рік тому +1

    FFIW, Windows NT 3.5 did have a MIPS build. #16:00

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

    17:00 Harvard teaches C first before any higher level language, which you can see in the publicly available version of their introductory CS50 module, CS50x

  • @adokce
    @adokce Рік тому

    hahahahahaha the last bit about carbon was icing on the cake.

  • @arimill1045
    @arimill1045 2 місяці тому

    I learned C when my friends took a minor introduction course and learned Java.
    To date they complain that they diddn't need to learn pointers, it made it more difficult for them to learn after the fact. So I say go all-in on complicated languages first.

  • @bdhaliwal24
    @bdhaliwal24 Рік тому

    Love this critical analysis

  • @RichardTMiles
    @RichardTMiles 3 місяці тому +1

    Google on Monday donated $1 million to the Rust Foundation specifically to improve interoperability between the language and C++. C++, a popular general purpose programming language, has arguably fallen out of fashion due to concerns over safety.Feb 5, 2024

  • @carlmuller4392
    @carlmuller4392 3 місяці тому

    C bloat? It does a copy of initialized data and if you are fancy clears the bss section and sets the stack pointer. Contains a few helper functions if you use longs or floats or divides.

  • @TheSulross
    @TheSulross 19 днів тому

    "not a great catcher" - coach probably made him play right field position like me

  • @arubaga
    @arubaga Рік тому

    I used Rust a bit but not super complicated. Perhaps there is a crate that uses mutexes as a kind of a buffer.

  • @xBZZZZyt
    @xBZZZZyt Рік тому

    03:33 what about python3?
    everything can raise exception if you press Ctrl+C

  • @goawqebt6931
    @goawqebt6931 Рік тому

    24:16
    Maybe we are looking for the word "Intuitions" or "heuristics"

  • @Pabloparsil
    @Pabloparsil Місяць тому

    Zig shouldn't have a lot of trouble entering any place where C is already in. That's the advantage, you can import any C function and you can even kinda transpile C to Zig. So in theory even if you don't have a library in Zig for what you want, so long as there is a C one you should be good

  • @debasishraychawdhuri
    @debasishraychawdhuri Рік тому +1

    How can someone hate unit testing? How else do you run your code check if it is working?

  • @brqnet8290
    @brqnet8290 Рік тому +2

    Zig has an official package manager called zpm, which can be used to manage dependencies and build your Zig projects.??

    • @ThePrimeTimeagen
      @ThePrimeTimeagen  Рік тому +1

      this must of been some what recent

    • @etodemerzel2627
      @etodemerzel2627 Рік тому +8

      ZPM is not an official package manager. Neither is zigmod. The devs have only recently started working on the official package manager (there's an article from October last year), it will be a part of the compiler.

    • @SuperHeroINTJ
      @SuperHeroINTJ Рік тому

      Just use Nix.

  • @lane1313
    @lane1313 Рік тому +15

    It's important to note, that the creator of Zig himself in a podcast a while back said Zig won't be prod ready for like another 10 years.

    • @aoeu256
      @aoeu256 11 місяців тому +2

      The singularity is in 2030, we will be using different cpu architectures different from zig and C…

    • @zeinfahrozi1733
      @zeinfahrozi1733 8 місяців тому +1

      And here we see Zig in Bun 1.0 🤣

    • @already_taken_
      @already_taken_ 2 місяці тому

      @@zeinfahrozi1733Not fully cover node yet

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

    learning computer programming for the first time is hard these days. I started in Pascal then learnt some C, then did some C++ back in the 90s. Then not being in software development, then just doing dirty for loops in interpreted languages where I didn't need to really care. Then coming back to Rust it makes you feel like you're doing CS 101 all over again. I think if people don't learn on Rust first, then people should learn in C then move to Rust.

  • @VojtaJavora
    @VojtaJavora Рік тому

    Maybe it's called a vector to draw a parallel with scalar values?

  • @gabereiser
    @gabereiser Рік тому

    To add to the "no hidden control flow", here's a story from the battlefield. Team of top notch engineers build a multi-peta-byte capable backend for dataflow and processing. Front-end team using some node+react end up on a call with the big wigs about why the application is erroring out. They point to the top notch engineers, I do a search from the stack to where the function is that isn't catching the throw. Turns out, they were calling us in node without ANY try catch or exception handling using promises or async. NONE! NONE AT ALL! So when their "fetch" threw an error (as one should when you receive a 500 from a server) it didn't know what to do and so it did.... nothing.... No error message, no UI update, no notification to the user, no log, nothing.

    • @Big_Red_Dork
      @Big_Red_Dork Рік тому

      How did they take having the finger being pointed back towards them? 😂

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

    Try-catch hidden control flow was just reimplementation of INTERCAL's COME FROM statement.

  • @emjizone
    @emjizone Рік тому +1

    7:50 You know you spent too much time on _Vim_ in a windowless room when…
    …you see bloat in _C_ . 😄

  • @mildlymusical4054
    @mildlymusical4054 Рік тому

    7:36 was that a simpsons reference ?, "Ma, don't worry about it"

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

    The main thing I hate about Zig is that it’s built on LLVM so it’s practically impossible to build from source on Windows.

  • @liorean
    @liorean Рік тому +3

    I've always been more in favour of the alternate return paths as arguments approach than the errors as return values approach. Basically, if a procedure can fail in a recoverable way, take the handler for that failure case as a required argument. If it can fail in non-recoverable ways, log+exit, crash hard and fast while keeping record of why. And if you want to provide the option for the caller to opt in to recoverability, those should be two (or more) different procedures with different signatures and not an optional parameter.

    • @chinoto1
      @chinoto1 Рік тому

      Seems helpful for a function with multiple steps where it could fail instead of splitting each stage into a separate function.
      You could have a single function that accepts Option-al handlers, maybe with a sort of builder style struct if there are a lot of handlers.
      I don't see why this pattern precludes ever using Result, in fact it could be useful to combine them in some scenarios.

    • @michaelthompson7217
      @michaelthompson7217 Рік тому

      it sounds like you prefer to crash and exit on any unrecoverable error?

    • @chinoto1
      @chinoto1 Рік тому

      @@michaelthompson7217 If it's deemed unrecoverable, what else are you supposed to do?

    • @liorean
      @liorean Рік тому

      @@michaelthompson7217 Unrecoverable errors basically have three possible paths to go. Muddle on in a corrupted state and accumulate garbage that you foist on the user, muddle on in a corrupted state and foist that corrupted state onto connected systems, or shut down - either as neatly as you can at your own devise, or hard and fast by the kernel.
      [EDIT] Becoming totally unresponsive and keeping rendering over everything else was a common fourth option back in the DOS and Windows 9x era, as well as anything else that running user programs in ring 0 afforded you...

  • @win.violin
    @win.violin 8 місяців тому

    0:18 That spit is personal. I always laugh out loud when hear that hawking sound followed by spitting for C++, C#. And I listen to these vids while doing something else :D
    Edited timestamp for better timing.

  • @DaddyFrosty
    @DaddyFrosty Рік тому

    There is two thing I respect Java for and that is SomeGeneric and forcing the developer to handle exceptions or declare that it throws an exception.

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

    Sorry, I am late to the party. I am an embedded C developer and I have a question regarding the sentence at 5:20
    Why C macro expansions are considered "devil" and why are they bad?

  • @echoptic775
    @echoptic775 Рік тому

    I love rust, but even after using it for a year i still feel like i dont know rust (specifically a lot of data structures in std) and im not even close to mastering it. I learned zig in a few hours with prior c and rust knowledge.
    Edit: also i would like to add that when working with memory in rust it always feels very forced and unnatural compared to zig

  • @ExpertOfNil
    @ExpertOfNil Рік тому +1

    Hell yea! Collab with LLL would be fan-friggin-tastic!

  • @Christian-of1tz
    @Christian-of1tz 7 місяців тому

    So do you do other kinds of testing instead? End to End?

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

    First programming language in my opinion should be a simple language that can just let you start programming.
    I started on C
    Novince we always envied how awesome and quick it is to work in python and js because of no types syntatic sugers and all.
    After maintaining a python code base with no types. I started to understand why types are important and then learnt typescript and java

  • @gokukakarot6323
    @gokukakarot6323 29 днів тому

    Zig's build system is great, takes away the pain of C . But then you have to take care of the allocators, which is cool for hobby projects, not sure in production.

  • @SuperHeroINTJ
    @SuperHeroINTJ Рік тому +1

    Likely Nix is what you need for 'downloading packages'.

  • @schwarzsterben1338
    @schwarzsterben1338 Рік тому

    How did you put grid lines to excalidraw?

  • @alphabasic1759
    @alphabasic1759 11 місяців тому +1

    The big problem with a lot of the more recent languages (or languages that have evolved a lot recently) is the excessive syntax. There are just too many syntactical additions in languages like rust or even python or recent versions of JavaScript for that matter.

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

      are they really 'too much' though? What is your metric for the justification of new syntax, and whats it's 'cost'?

  • @erniepaj
    @erniepaj Рік тому

    The dog scratching 😂

  • @codyhamilton7682
    @codyhamilton7682 Місяць тому

    My first programming language I got decent with was C, took a programing in C class at a community college when I was a junior in highschool
    The class was part of the computer information system CIS department and not the computer science CS department. I think those where the department names or something like that been awhile. The CIS was geared towards getting people jobs with 2 year degrees where the CS was to prepare you for 4 year computer science programs
    I ened up getting a AS in comp sci after highschool, but while in highschool I bridge for several credits. The programing in C was the first class I did and was offered by the CIS department. The next year my senior year of highschool for the fall semester at the college I took a programming in C++ class which had the C class as a prerequisite, the assignment week one involved making linked lists using manual memory management in the C code before doing it with c++/objects... That semester I also took programing 1 in the CS department, was funny learning if statements in Java the same time I was doing linked lists

  • @aaronpolichar7936
    @aaronpolichar7936 3 місяці тому

    I would have thought the main application of Zig would be for great justice

  • @Kodlak15
    @Kodlak15 Рік тому +1

    Came for the reaction, stayed for the yelling 👍

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

    NULL termination: Use clang-tidy and activate "bugprone-not-null-terminated-result" and "bugprone-string-literal-with-embedded-nul¶".
    Problem solved. I couldn't image programming C or C++ without clang-tidy and clang-format. And please active the clang- or the gcc-sanatizers as well.

  • @climatechangedoesntbargain9140

    8:00 feel you 😃