Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Zig... anyone try it?

Zig... anyone try it?

Scheduled Pinned Locked Moved The Lounge
c++javascriptperformancehelpquestion
24 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Jeremy Falcon

    Yeah. Much like C, you don't have stuff like regex out of the box. But, nothing stopping you from using the PCRE C library or a Zig regex library. So, I'm sure it wouldn't appeal to everyone. For those of us to still love C but want something a bit newer (like a better type system)... it's sounding cool. It does bake in unit testing though, which while you can do in C... it's not really baked in.

    Jeremy Falcon

    Mike HankeyM Offline
    Mike HankeyM Offline
    Mike Hankey
    wrote on last edited by
    #4

    The thing with C is it's universal, it runs on dang near any machine. I started to learn Rust but got bogged down because it doesn't/wouldn't compile for embedded systems. (Without a lot of foul language involved) If I do Desktop or Web stuff I use C# and associated tools.

    A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

    J 1 Reply Last reply
    0
    • Mike HankeyM Mike Hankey

      The thing with C is it's universal, it runs on dang near any machine. I started to learn Rust but got bogged down because it doesn't/wouldn't compile for embedded systems. (Without a lot of foul language involved) If I do Desktop or Web stuff I use C# and associated tools.

      A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #5

      Mike Hankey wrote:

      The thing with C is it's universal, it runs on dang near any machine.

      Currently, Zig uses LLVM to produce object code. The same as Rust and clang. Zig has its own linker though. There have been talks about replacing LLVM usage in Zig down the road, but suffice it to say, the very nature of LLVM executable is to also be universal. It actually takes it even one step further and allows you to easily cross-compile, which isn't so easy to do in C. Keep in mind, it's a system language. Which is to say, like C, there's no runtime that runs along aside it with a garbage collector, etc. So, as long as there's a binary and instruction compatibility (which LLVM handles) then the universality of it will depend on the programmer making system calls, etc. And LLVM supports all the major formats: COFF, ELF, etc. and instruction sets. Now, can I guarantee there's not some esoteric compatibility out that LLVM doesn't cover? Nope. I'm sure there a few chips it doesn't support. But that doesn't mean we shouldn't use a language. It'll cover 99.9% of the use cases. If you're the one out of a million that needs to support some chip nobody ever heard of, use C. But, if you want something a bit more modern, but without acting "rusty" like Rust there are options. :laugh:

      Mike Hankey wrote:

      I started to learn Rust but got bogged down because it doesn't/wouldn't compile for embedded systems.

      IMO Rust took a great concept and over complicated it, which I could look past because the complication also comes with benefits. But, combine that with being too opinionated and the ecosystem being littered with childish zealots... let's just say I deal with enough of that from JavaScript/TypeScript. :laugh:

      Mike Hankey wrote:

      If I do Desktop or Web stuff I use C# and associated tools.

      For me, it's Node for web dev and will be for the foreseeable future. Butttt... for lower level stuff me looky looky.

      Jeremy Falcon

      Mike HankeyM 1 Reply Last reply
      0
      • J Jeremy Falcon

        Mike Hankey wrote:

        The thing with C is it's universal, it runs on dang near any machine.

        Currently, Zig uses LLVM to produce object code. The same as Rust and clang. Zig has its own linker though. There have been talks about replacing LLVM usage in Zig down the road, but suffice it to say, the very nature of LLVM executable is to also be universal. It actually takes it even one step further and allows you to easily cross-compile, which isn't so easy to do in C. Keep in mind, it's a system language. Which is to say, like C, there's no runtime that runs along aside it with a garbage collector, etc. So, as long as there's a binary and instruction compatibility (which LLVM handles) then the universality of it will depend on the programmer making system calls, etc. And LLVM supports all the major formats: COFF, ELF, etc. and instruction sets. Now, can I guarantee there's not some esoteric compatibility out that LLVM doesn't cover? Nope. I'm sure there a few chips it doesn't support. But that doesn't mean we shouldn't use a language. It'll cover 99.9% of the use cases. If you're the one out of a million that needs to support some chip nobody ever heard of, use C. But, if you want something a bit more modern, but without acting "rusty" like Rust there are options. :laugh:

        Mike Hankey wrote:

        I started to learn Rust but got bogged down because it doesn't/wouldn't compile for embedded systems.

        IMO Rust took a great concept and over complicated it, which I could look past because the complication also comes with benefits. But, combine that with being too opinionated and the ecosystem being littered with childish zealots... let's just say I deal with enough of that from JavaScript/TypeScript. :laugh:

        Mike Hankey wrote:

        If I do Desktop or Web stuff I use C# and associated tools.

        For me, it's Node for web dev and will be for the foreseeable future. Butttt... for lower level stuff me looky looky.

        Jeremy Falcon

        Mike HankeyM Offline
        Mike HankeyM Offline
        Mike Hankey
        wrote on last edited by
        #6

        I may have to look at it then, had no idea it could link to ELF.

        Jeremy Falcon wrote:

        And LLVM supports all the major formats: COFF, ELF, etc. and instruction sets.

        Thanks for the heads up.

        A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

        J 1 Reply Last reply
        0
        • Mike HankeyM Mike Hankey

          I may have to look at it then, had no idea it could link to ELF.

          Jeremy Falcon wrote:

          And LLVM supports all the major formats: COFF, ELF, etc. and instruction sets.

          Thanks for the heads up.

          A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

          J Offline
          J Offline
          Jeremy Falcon
          wrote on last edited by
          #7

          Any time man. And I get it; I'll never fully replace C in my heart. :laugh: It's literally the backbone of the world we live in.

          Jeremy Falcon

          Mike HankeyM N 2 Replies Last reply
          0
          • J Jeremy Falcon

            Any time man. And I get it; I'll never fully replace C in my heart. :laugh: It's literally the backbone of the world we live in.

            Jeremy Falcon

            Mike HankeyM Offline
            Mike HankeyM Offline
            Mike Hankey
            wrote on last edited by
            #8

            Turns out Visual Code has a ZIG language extension. How cool is that? :)

            A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

            J 2 Replies Last reply
            0
            • Mike HankeyM Mike Hankey

              Turns out Visual Code has a ZIG language extension. How cool is that? :)

              A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

              J Offline
              J Offline
              Jeremy Falcon
              wrote on last edited by
              #9

              Sweeet

              Jeremy Falcon

              1 Reply Last reply
              0
              • Mike HankeyM Mike Hankey

                Turns out Visual Code has a ZIG language extension. How cool is that? :)

                A home without books is a body without soul. Marcus Tullius Cicero PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com Latest Article: EventAggregator

                J Offline
                J Offline
                Jeremy Falcon
                wrote on last edited by
                #10

                Right now, from an ecosystem standpoint, it's like Rust was back in 2015 before anyone really used it. So, while there are a few online resources like [zig.guide](https://zig.guide/) (which is one version behind), it's nowhere near as extensive as Rust. And it's not even 1.0 yet. There's a few places online for some docs though and some [YT videos](https://www.youtube.com/watch?v=MMtvGA1YhW4&list=PLtB7CL7EG7pCw7Xy1SQC53Gl8pI7aDg9t). Still, you can still do stuff like pointer arithmetic. Granted, it's going to make you earn it, by having to cast a pointer to an integer first, as it tries to discourage that... but you can if you need to. One thing it does do that C doesn't is have a concept of [optional](https://zig.guide/language-basics/optionals/) pointers vs non-optional ones. The compiler will complain if you have a non-optional pointer with no value... I think. I'm still learning.

                Jeremy Falcon

                1 Reply Last reply
                0
                • J Jeremy Falcon

                  Any time man. And I get it; I'll never fully replace C in my heart. :laugh: It's literally the backbone of the world we live in.

                  Jeremy Falcon

                  N Offline
                  N Offline
                  Nelek
                  wrote on last edited by
                  #11

                  Jeremy Falcon wrote:

                  It's literally the backbone of the world we live in.

                  A quote I have seen (and used myself once too): "Do not forget that my compiler compiled your compiler." :-D :-D

                  M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                  1 Reply Last reply
                  0
                  • J Jeremy Falcon

                    I find myself with the itch to learn a new system programming language. I really, really wanted to like Rust because I think the idea of compile time memory checks is great. And you don't want to become a dinosaur where tech passes you by. But, it's too opinionated... with crap that doesn't even matter. Like good luck changing the `src` directory to `app` to discourage too many acronyms being used (I consider app shorthand and not an acronym). Rust be like... nope you too st00pid for dat. Now, C will always be my favorite language, despite the fact I rarely use it these days and spend my time in TypeScript. For all the C haters out there... look inward. People that hate C are usually young kids who never used it. Moving on is one thing, but hatred is another. IMO it's not that hard to understand safe memory management. All the hoopla about C sucking is just that... hoopla. Unfortunately, I understand that most programmers never really take the time to learn crap, so I do get the need to rethink things to prevent overflows. Anyway, so I heard about Zig. Being a C fanboi and its two-way interoperability with it, I was immediately like... noice. Can't say I'm crazy about the name, but at least I can change my `src` directory to `app`. :laugh: It doesn't have a borrow checker like Rust, but it does have a way to at least help track down memory issues which is pretty clever. There's no global memory allocator at all. And it has a pretty nifty compile time build system that's like C++'s templating on steroids. It doesn't have nearly the tooling as Rust, but then again neither does C. :laugh: But, it can use any C library, so you don't have to do everything from scratch at least. Anyone try it? Like it? Don't like it? Has cooties?

                    Jeremy Falcon

                    Z Offline
                    Z Offline
                    Zuhaid Jan
                    wrote on last edited by
                    #12

                    ou've hit the nail on the head with your assessment of Rust and C. Rust's rigidity, while aiming for safety, can often feel restrictive. C, while potent, demands discipline and is unforgiving of errors. Zig seems to offer a compelling middle ground. Its C-like syntax and interoperability are huge pluses for those coming from a C background. The ability to fine-tune memory management without sacrificing safety is intriguing. And let's not forget the compile-time magic that can potentially supercharge development. However, it's still a relatively new language. The ecosystem and tooling might not be as mature as Rust or C++. There could be potential pitfalls or limitations we haven't discovered yet. I'd love to hear from others who have dived into Zig. Your experiences, both good and bad, would be invaluable. Have you tried Zig? What were your first impressions? Did you encounter any significant challenges or limitations? Let's share our thoughts and help the community grow

                    J 1 Reply Last reply
                    0
                    • Z Zuhaid Jan

                      ou've hit the nail on the head with your assessment of Rust and C. Rust's rigidity, while aiming for safety, can often feel restrictive. C, while potent, demands discipline and is unforgiving of errors. Zig seems to offer a compelling middle ground. Its C-like syntax and interoperability are huge pluses for those coming from a C background. The ability to fine-tune memory management without sacrificing safety is intriguing. And let's not forget the compile-time magic that can potentially supercharge development. However, it's still a relatively new language. The ecosystem and tooling might not be as mature as Rust or C++. There could be potential pitfalls or limitations we haven't discovered yet. I'd love to hear from others who have dived into Zig. Your experiences, both good and bad, would be invaluable. Have you tried Zig? What were your first impressions? Did you encounter any significant challenges or limitations? Let's share our thoughts and help the community grow

                      J Offline
                      J Offline
                      Jeremy Falcon
                      wrote on last edited by
                      #13

                      I haven't used it in a project yet. So far it's just been playing around and watching YT videos. I too, am worried about the ecosystem. Granted, every ecosystem is small when something is new. So, I doubt I'd use it for an enterprise application just yet, but for home projects I would.

                      Jeremy Falcon

                      1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        I find myself with the itch to learn a new system programming language. I really, really wanted to like Rust because I think the idea of compile time memory checks is great. And you don't want to become a dinosaur where tech passes you by. But, it's too opinionated... with crap that doesn't even matter. Like good luck changing the `src` directory to `app` to discourage too many acronyms being used (I consider app shorthand and not an acronym). Rust be like... nope you too st00pid for dat. Now, C will always be my favorite language, despite the fact I rarely use it these days and spend my time in TypeScript. For all the C haters out there... look inward. People that hate C are usually young kids who never used it. Moving on is one thing, but hatred is another. IMO it's not that hard to understand safe memory management. All the hoopla about C sucking is just that... hoopla. Unfortunately, I understand that most programmers never really take the time to learn crap, so I do get the need to rethink things to prevent overflows. Anyway, so I heard about Zig. Being a C fanboi and its two-way interoperability with it, I was immediately like... noice. Can't say I'm crazy about the name, but at least I can change my `src` directory to `app`. :laugh: It doesn't have a borrow checker like Rust, but it does have a way to at least help track down memory issues which is pretty clever. There's no global memory allocator at all. And it has a pretty nifty compile time build system that's like C++'s templating on steroids. It doesn't have nearly the tooling as Rust, but then again neither does C. :laugh: But, it can use any C library, so you don't have to do everything from scratch at least. Anyone try it? Like it? Don't like it? Has cooties?

                        Jeremy Falcon

                        J Offline
                        J Offline
                        jmaida
                        wrote on last edited by
                        #14

                        i downloaded it. i'll check it out, but not right now. hardware/software issues to work on.

                        "A little time, a little trouble, your better day" Badfinger

                        J 1 Reply Last reply
                        0
                        • J jmaida

                          i downloaded it. i'll check it out, but not right now. hardware/software issues to work on.

                          "A little time, a little trouble, your better day" Badfinger

                          J Offline
                          J Offline
                          Jeremy Falcon
                          wrote on last edited by
                          #15

                          jmaida wrote:

                          i downloaded it. i'll check it out, but not right now.

                          Cool man.

                          jmaida wrote:

                          hardware/software issues to work on.

                          Good times. Good times. :laugh:

                          Jeremy Falcon

                          J 1 Reply Last reply
                          0
                          • J Jeremy Falcon

                            jmaida wrote:

                            i downloaded it. i'll check it out, but not right now.

                            Cool man.

                            jmaida wrote:

                            hardware/software issues to work on.

                            Good times. Good times. :laugh:

                            Jeremy Falcon

                            J Offline
                            J Offline
                            jmaida
                            wrote on last edited by
                            #16

                            Ain't that the truth. I am a old C programmer, as well, so I like what I am seeing.

                            "A little time, a little trouble, your better day" Badfinger

                            J 1 Reply Last reply
                            0
                            • J jmaida

                              Ain't that the truth. I am a old C programmer, as well, so I like what I am seeing.

                              "A little time, a little trouble, your better day" Badfinger

                              J Offline
                              J Offline
                              Jeremy Falcon
                              wrote on last edited by
                              #17

                              Noice

                              Jeremy Falcon

                              J 1 Reply Last reply
                              0
                              • J Jeremy Falcon

                                Noice

                                Jeremy Falcon

                                J Offline
                                J Offline
                                jmaida
                                wrote on last edited by
                                #18

                                noice? not cool?

                                "A little time, a little trouble, your better day" Badfinger

                                J 1 Reply Last reply
                                0
                                • J jmaida

                                  noice? not cool?

                                  "A little time, a little trouble, your better day" Badfinger

                                  J Offline
                                  J Offline
                                  Jeremy Falcon
                                  wrote on last edited by
                                  #19

                                  Coolio?

                                  Jeremy Falcon

                                  1 Reply Last reply
                                  0
                                  • J Jeremy Falcon

                                    I find myself with the itch to learn a new system programming language. I really, really wanted to like Rust because I think the idea of compile time memory checks is great. And you don't want to become a dinosaur where tech passes you by. But, it's too opinionated... with crap that doesn't even matter. Like good luck changing the `src` directory to `app` to discourage too many acronyms being used (I consider app shorthand and not an acronym). Rust be like... nope you too st00pid for dat. Now, C will always be my favorite language, despite the fact I rarely use it these days and spend my time in TypeScript. For all the C haters out there... look inward. People that hate C are usually young kids who never used it. Moving on is one thing, but hatred is another. IMO it's not that hard to understand safe memory management. All the hoopla about C sucking is just that... hoopla. Unfortunately, I understand that most programmers never really take the time to learn crap, so I do get the need to rethink things to prevent overflows. Anyway, so I heard about Zig. Being a C fanboi and its two-way interoperability with it, I was immediately like... noice. Can't say I'm crazy about the name, but at least I can change my `src` directory to `app`. :laugh: It doesn't have a borrow checker like Rust, but it does have a way to at least help track down memory issues which is pretty clever. There's no global memory allocator at all. And it has a pretty nifty compile time build system that's like C++'s templating on steroids. It doesn't have nearly the tooling as Rust, but then again neither does C. :laugh: But, it can use any C library, so you don't have to do everything from scratch at least. Anyone try it? Like it? Don't like it? Has cooties?

                                    Jeremy Falcon

                                    T Offline
                                    T Offline
                                    Tokinabo
                                    wrote on last edited by
                                    #20

                                    I'm not a C programmer, so forgive my eventual stupid question: there is/was also a language called 'D' which claimed to enhance some of C flaws. I'm not a D programmer either. Anyone here with enough ZIG and D experience to compare both?

                                    J 1 Reply Last reply
                                    0
                                    • J Jeremy Falcon

                                      I find myself with the itch to learn a new system programming language. I really, really wanted to like Rust because I think the idea of compile time memory checks is great. And you don't want to become a dinosaur where tech passes you by. But, it's too opinionated... with crap that doesn't even matter. Like good luck changing the `src` directory to `app` to discourage too many acronyms being used (I consider app shorthand and not an acronym). Rust be like... nope you too st00pid for dat. Now, C will always be my favorite language, despite the fact I rarely use it these days and spend my time in TypeScript. For all the C haters out there... look inward. People that hate C are usually young kids who never used it. Moving on is one thing, but hatred is another. IMO it's not that hard to understand safe memory management. All the hoopla about C sucking is just that... hoopla. Unfortunately, I understand that most programmers never really take the time to learn crap, so I do get the need to rethink things to prevent overflows. Anyway, so I heard about Zig. Being a C fanboi and its two-way interoperability with it, I was immediately like... noice. Can't say I'm crazy about the name, but at least I can change my `src` directory to `app`. :laugh: It doesn't have a borrow checker like Rust, but it does have a way to at least help track down memory issues which is pretty clever. There's no global memory allocator at all. And it has a pretty nifty compile time build system that's like C++'s templating on steroids. It doesn't have nearly the tooling as Rust, but then again neither does C. :laugh: But, it can use any C library, so you don't have to do everything from scratch at least. Anyone try it? Like it? Don't like it? Has cooties?

                                      Jeremy Falcon

                                      G Offline
                                      G Offline
                                      giulicard
                                      wrote on last edited by
                                      #21

                                      As far as I know, Zig is a language that promotes the DOD (Data Oriented Design) style. Its creator, Andrew Kelley has posted a lot of material about DOD and the like. There are several online resources about DOD, including videos by the author of Zig. Also articles like: Data Oriented Design: A Way of Thinking - Hello C++[^] Regards

                                      J 1 Reply Last reply
                                      0
                                      • T Tokinabo

                                        I'm not a C programmer, so forgive my eventual stupid question: there is/was also a language called 'D' which claimed to enhance some of C flaws. I'm not a D programmer either. Anyone here with enough ZIG and D experience to compare both?

                                        J Offline
                                        J Offline
                                        Jeremy Falcon
                                        wrote on last edited by
                                        #22

                                        Nothing against D, but AFAIK (could be wrong) it's always had a garbage collector. I heard talks about them trying to make it optional, but not sure if that's happened yet. If I was gonna use a GC language, may as well use Go that's backed by Google ya know.

                                        Jeremy Falcon

                                        T 1 Reply Last reply
                                        0
                                        • G giulicard

                                          As far as I know, Zig is a language that promotes the DOD (Data Oriented Design) style. Its creator, Andrew Kelley has posted a lot of material about DOD and the like. There are several online resources about DOD, including videos by the author of Zig. Also articles like: Data Oriented Design: A Way of Thinking - Hello C++[^] Regards

                                          J Offline
                                          J Offline
                                          Jeremy Falcon
                                          wrote on last edited by
                                          #23

                                          Cool, I'll have to check it out. Thanks.

                                          Jeremy Falcon

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups