Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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 (Darkly)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Uncategorized
  3. Look what I found

Look what I found

Scheduled Pinned Locked Moved Uncategorized
49 Posts 37 Posters 0 Views
  • 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.
  • System FaultE System Fault

    Look what I found

    Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

    The Penguin of EvilE This user is from outside of this forum
    The Penguin of EvilE This user is from outside of this forum
    The Penguin of Evil
    wrote last edited by
    #18

    @error It's an utter pain in the arse when writing a compiler too, and even worse is when goto gets involved.

    1 Reply Last reply
    0
    • MichaelM Michael

      @error that's wild. I wonder how this would be treated by different formatters/style enforcers and if it would break

      System FaultE This user is from outside of this forum
      System FaultE This user is from outside of this forum
      System Fault
      wrote last edited by
      #19

      @mikee I actually tried it. It works just fine to my surprise. But the clangd formatter gone mad:

      MichaelM h3mmy :v_enby:H 2 Replies Last reply
      0
      • System FaultE System Fault

        @_the_cloud Yeah, but if you click the link, they actually use default case there.

        poleguy looking for lost toolsP This user is from outside of this forum
        poleguy looking for lost toolsP This user is from outside of this forum
        poleguy looking for lost tools
        wrote last edited by
        #20

        @error @_the_cloud Only in the original example, not in the first two. I'd set it to 3 and chuckle too. I'm an FPGA guy, so I always think about else/default.

        1 Reply Last reply
        0
        • System FaultE System Fault

          Look what I found

          Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

          poleguy looking for lost toolsP This user is from outside of this forum
          poleguy looking for lost toolsP This user is from outside of this forum
          poleguy looking for lost tools
          wrote last edited by
          #21

          @error gloop, arfle, barfle says it all.

          1 Reply Last reply
          0
          • System FaultE System Fault

            @mikee I actually tried it. It works just fine to my surprise. But the clangd formatter gone mad:

            MichaelM This user is from outside of this forum
            MichaelM This user is from outside of this forum
            Michael
            wrote last edited by
            #22

            @error ha! Thanks for testing!

            1 Reply Last reply
            0
            • System FaultE System Fault

              Look what I found

              Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

              Scott :mbta_glx:S This user is from outside of this forum
              Scott :mbta_glx:S This user is from outside of this forum
              Scott :mbta_glx:
              wrote last edited by
              #23

              @error it's beautiful

              1 Reply Last reply
              0
              • System FaultE System Fault

                Look what I found

                Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                Malcolm HerbertM This user is from outside of this forum
                Malcolm HerbertM This user is from outside of this forum
                Malcolm Herbert
                wrote last edited by
                #24

                @error reminds me of Duff's Device for abitrary length byte copy using the switch as an index into an architecture-appropriate unrolled loop https://en.wikipedia.org/wiki/Duff%27s_device

                1 Reply Last reply
                0
                • Vaporeon :vaporeon:V Vaporeon :vaporeon:

                  @error That's super neat, I didn't know! I'll probably use this in my code at a some point...

                  System FaultE This user is from outside of this forum
                  System FaultE This user is from outside of this forum
                  System Fault
                  wrote last edited by
                  #25

                  @vaporeon_ please don't 😃

                  1 Reply Last reply
                  0
                  • System FaultE System Fault

                    Look what I found

                    Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                    Western InfidelsW This user is from outside of this forum
                    Western InfidelsW This user is from outside of this forum
                    Western Infidels
                    wrote last edited by
                    #26

                    @error I don't think I ever would have tried to pass that off, myself, but I sort of admire the fact that, even though it's language abuse, it produces a predictable outcome. C has a lot of undefined behavior, but somehow, this isn't.

                    I think I tried to use Duff's Device in a project once, but my colleagues objected and made me change it. Or maybe I just explained Duff's Device to them and they were horrified. Like, "I don't know if I can trust that guy anymore" horrified. It was a long time ago.

                    This is interesting but it's not really saving a ton of time or code space. I think Duff's Device is probably more defensible.

                    System FaultE 1 Reply Last reply
                    0
                    • System FaultE System Fault

                      Look what I found

                      Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                      ewhacE This user is from outside of this forum
                      ewhacE This user is from outside of this forum
                      ewhac
                      wrote last edited by
                      #27

                      @error @TomDuff, call your office...

                      Tom DuffT 1 Reply Last reply
                      0
                      • mmu_manM mmu_man

                        @error yup that's how Contiki implemented Protothreads initially:

                        https://dunkels.com/adam/pt/

                        ewhacE This user is from outside of this forum
                        ewhacE This user is from outside of this forum
                        ewhac
                        wrote last edited by
                        #28

                        @mmu_man @error Never heard of these before; thank you!

                        1 Reply Last reply
                        0
                        • Western InfidelsW Western Infidels

                          @error I don't think I ever would have tried to pass that off, myself, but I sort of admire the fact that, even though it's language abuse, it produces a predictable outcome. C has a lot of undefined behavior, but somehow, this isn't.

                          I think I tried to use Duff's Device in a project once, but my colleagues objected and made me change it. Or maybe I just explained Duff's Device to them and they were horrified. Like, "I don't know if I can trust that guy anymore" horrified. It was a long time ago.

                          This is interesting but it's not really saving a ton of time or code space. I think Duff's Device is probably more defensible.

                          System FaultE This user is from outside of this forum
                          System FaultE This user is from outside of this forum
                          System Fault
                          wrote last edited by
                          #29

                          @WesternInfidels It produces warning, so I personally won't use it. But it looks beautiful

                          1 Reply Last reply
                          0
                          • System FaultE System Fault

                            Look what I found

                            Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                            elle mundyE This user is from outside of this forum
                            elle mundyE This user is from outside of this forum
                            elle mundy
                            wrote last edited by
                            #30

                            @error reminds me of duff’s device https://en.wikipedia.org/wiki/Duff%27s_device

                            1 Reply Last reply
                            0
                            • ewhacE ewhac

                              @error @TomDuff, call your office...

                              Tom DuffT This user is from outside of this forum
                              Tom DuffT This user is from outside of this forum
                              Tom Duff
                              wrote last edited by
                              #31

                              @ewhac @error Insane. No one in his right mind calls functions arfle and barfle.

                              1 Reply Last reply
                              0
                              • System FaultE System Fault

                                Look what I found

                                Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                                Kelly SchultzS This user is from outside of this forum
                                Kelly SchultzS This user is from outside of this forum
                                Kelly Schultz
                                wrote last edited by
                                #32

                                @error time to see who at my workplace I can aggravate the most

                                1 Reply Last reply
                                0
                                • System FaultE System Fault

                                  Look what I found

                                  Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                                  wyattW This user is from outside of this forum
                                  wyattW This user is from outside of this forum
                                  wyatt
                                  wrote last edited by
                                  #33
                                  @error yes
                                  1 Reply Last reply
                                  0
                                  • System FaultE System Fault

                                    Look what I found

                                    Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                                    wyattW This user is from outside of this forum
                                    wyattW This user is from outside of this forum
                                    wyatt
                                    wrote last edited by
                                    #34
                                    @error this is devious and i love it
                                    1 Reply Last reply
                                    0
                                    • System FaultE System Fault

                                      Look what I found

                                      Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                                      koorogiK This user is from outside of this forum
                                      koorogiK This user is from outside of this forum
                                      koorogi
                                      wrote last edited by
                                      #35

                                      @error musl does this in its printf implementation: https://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c#n597

                                      System FaultE 1 Reply Last reply
                                      0
                                      • System FaultE System Fault

                                        Look what I found

                                        Here: http://pigeonsnest.co.uk/stuff/pigeons-device.html

                                        Eckes :mastodon:E This user is from outside of this forum
                                        Eckes :mastodon:E This user is from outside of this forum
                                        Eckes :mastodon:
                                        wrote last edited by
                                        #36

                                        @error wow it does not even -Wextra the nested labels

                                        1 Reply Last reply
                                        0
                                        • gloriouscowG gloriouscow

                                          @error

                                          switches are just polyamorous gotos

                                          Saffron🏳️‍⚧️S This user is from outside of this forum
                                          Saffron🏳️‍⚧️S This user is from outside of this forum
                                          Saffron🏳️‍⚧️
                                          wrote last edited by
                                          #37

                                          @gloriouscow @error the important part is the boundaries tbh

                                          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.
                                          Powered by NodeBB Contributors
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups