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 (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. A tale in 3 pictures.

A tale in 3 pictures.

Scheduled Pinned Locked Moved Uncategorized
programming
103 Posts 56 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.
  • citizen428@chaos.socialC citizen428@chaos.social

    A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

    #c #programming

    aartaka@merveilles.townA This user is from outside of this forum
    aartaka@merveilles.townA This user is from outside of this forum
    aartaka@merveilles.town
    wrote last edited by
    #45

    @citizen428 yes, that’s a thing I built my website on, at some point <https://aartaka.me/this-post-is-cpp.html> (migrated to ed(1) since then.)

    citizen428@chaos.socialC 1 Reply Last reply
    0
    • citizen428@chaos.socialC citizen428@chaos.social

      A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

      #c #programming

      mirabilos@toot.mirbsd.orgM This user is from outside of this forum
      mirabilos@toot.mirbsd.orgM This user is from outside of this forum
      mirabilos@toot.mirbsd.org
      wrote last edited by
      #46

      @citizen428 ok, that’s a different kind of using cpp(1) as a webpage templating engine than what I did.

      Won’t escape, of course…

      citizen428@chaos.socialC 1 Reply Last reply
      0
      • citizen428@chaos.socialC citizen428@chaos.social

        The horrors:

        Link Preview Image
        C preprocessor abuse

        C preprocessor abuse. GitHub Gist: instantly share code, notes, and snippets.

        favicon

        Gist (gist.github.com)

        hannahk@floss.socialH This user is from outside of this forum
        hannahk@floss.socialH This user is from outside of this forum
        hannahk@floss.social
        wrote last edited by
        #47

        @citizen428 Glorious

        citizen428@chaos.socialC 1 Reply Last reply
        0
        • citizen428@chaos.socialC citizen428@chaos.social

          A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

          #c #programming

          thepolishdispatch@mstdn.socialT This user is from outside of this forum
          thepolishdispatch@mstdn.socialT This user is from outside of this forum
          thepolishdispatch@mstdn.social
          wrote last edited by
          #48

          @citizen428 chef's kiss

          1 Reply Last reply
          0
          • tea@chaos.socialT tea@chaos.social

            @citizen428 reminds me of the horrors me and @friz64 were up to, also serving an entire web page from an ESP32 as one big string iirc, base64 encoded images and all.

            nyanpasu64@donotsta.reN This user is from outside of this forum
            nyanpasu64@donotsta.reN This user is from outside of this forum
            nyanpasu64@donotsta.re
            wrote last edited by
            #49
            @tea @citizen428 @friz64 reminded of tue gbs-control building a webpage into a byte array and spitting it out at runtime, as well as saving and loading files in a flash filesystem
            and the gazillion associated race conditions
            1 Reply Last reply
            0
            • citizen428@chaos.socialC citizen428@chaos.social

              A tale in 3 pictures. In which our hero wonders if he can and doesn't stop to ask if he should.

              #c #programming

              malwareminigun@infosec.exchangeM This user is from outside of this forum
              malwareminigun@infosec.exchangeM This user is from outside of this forum
              malwareminigun@infosec.exchange
              wrote last edited by
              #50

              @citizen428 This is extra bad because cpp isn't specified in a way you can necessarily cough up matching text and different compilers resolve that problem in their preprocessed output in different ways...

              citizen428@chaos.socialC 1 Reply Last reply
              0
              • crazyeddie@mastodon.socialC crazyeddie@mastodon.social

                @Lemmus @citizen428 https://github.com/crazy-eddie/arduino_modern/blob/capacities/include/hardware/chip/atmega328p.hpp

                adrianvovk@fosstodon.orgA This user is from outside of this forum
                adrianvovk@fosstodon.orgA This user is from outside of this forum
                adrianvovk@fosstodon.org
                wrote last edited by
                #51

                @crazyeddie @Lemmus @citizen428 The HTML thing is mostly fine. The macros are being used basically as intended.

                But this.......

                1 Reply Last reply
                0
                • wonka@chaos.socialW wonka@chaos.social

                  Looks a bit like perlcgi.

                  @Lemmus @citizen428

                  citizen428@chaos.socialC This user is from outside of this forum
                  citizen428@chaos.socialC This user is from outside of this forum
                  citizen428@chaos.social
                  wrote last edited by
                  #52

                  @wonka @Lemmus I did (do?) have a soft spot for Perl 🙂

                  stefanct@chaos.socialS wonka@chaos.socialW 2 Replies Last reply
                  0
                  • crazyeddie@mastodon.socialC crazyeddie@mastodon.social

                    @Lemmus @citizen428 https://github.com/crazy-eddie/arduino_modern/blob/capacities/include/hardware/chip/atmega328p.hpp

                    citizen428@chaos.socialC This user is from outside of this forum
                    citizen428@chaos.socialC This user is from outside of this forum
                    citizen428@chaos.social
                    wrote last edited by
                    #53

                    @crazyeddie @Lemmus Is there a word for the combination of impressed and revolted? Because I definitely feel imvolted after seeing this 😉

                    1 Reply Last reply
                    0
                    • necrophcodr@layer8.spaceN necrophcodr@layer8.space

                      @citizen428 some slight modifications, and you can use cpp -E + that to make a static site generator using the preprocessor.

                      citizen428@chaos.socialC This user is from outside of this forum
                      citizen428@chaos.socialC This user is from outside of this forum
                      citizen428@chaos.social
                      wrote last edited by
                      #54

                      @necrophcodr Funny you'd say that, because this (`clang -I. -P -E`) but in another context is how this little side quest started.

                      necrophcodr@layer8.spaceN 1 Reply Last reply
                      0
                      • phantasus@fedi.atP phantasus@fedi.at

                        @leyrer @citizen428 I would say finally that the C pre-processor is nearing the realm of the mighty lisp macro systems.

                        citizen428@chaos.socialC This user is from outside of this forum
                        citizen428@chaos.socialC This user is from outside of this forum
                        citizen428@chaos.social
                        wrote last edited by
                        #55

                        @phantasus @leyrer If only. But nothing is stopping you from running a custom preprocessor like m4 as part of the build system. Though that seemed like overkill for what was supposed to be a half hour diversion.

                        1 Reply Last reply
                        0
                        • hannahk@floss.socialH hannahk@floss.social

                          @citizen428 Glorious

                          citizen428@chaos.socialC This user is from outside of this forum
                          citizen428@chaos.socialC This user is from outside of this forum
                          citizen428@chaos.social
                          wrote last edited by
                          #56

                          @hannahk The things we do to avoid actual work, eh? 🙂

                          1 Reply Last reply
                          0
                          • reiddragon@fedi.catto.gardenR reiddragon@fedi.catto.garden
                            @citizen428 I mean, this is actually not *that* far off from what lispers do when generating sites in lisp
                            citizen428@chaos.socialC This user is from outside of this forum
                            citizen428@chaos.socialC This user is from outside of this forum
                            citizen428@chaos.social
                            wrote last edited by
                            #57

                            @reiddragon Sure, but compared to operating on an AST simple text substitution only gets you this far.

                            1 Reply Last reply
                            0
                            • millihertz@oldbytes.spaceM millihertz@oldbytes.space

                              @citizen428

                              citizen428@chaos.socialC This user is from outside of this forum
                              citizen428@chaos.socialC This user is from outside of this forum
                              citizen428@chaos.social
                              wrote last edited by
                              #58

                              @millihertz 10/10 emoji reaction.

                              1 Reply Last reply
                              0
                              • tea@chaos.socialT tea@chaos.social

                                @citizen428 reminds me of the horrors me and @friz64 were up to, also serving an entire web page from an ESP32 as one big string iirc, base64 encoded images and all.

                                citizen428@chaos.socialC This user is from outside of this forum
                                citizen428@chaos.socialC This user is from outside of this forum
                                citizen428@chaos.social
                                wrote last edited by
                                #59

                                @tea @friz64 I'd unironically like to learn more about this.

                                1 Reply Last reply
                                0
                                • jwo@mastodonczech.czJ jwo@mastodonczech.cz

                                  @citizen428 That's called GNU M4.

                                  citizen428@chaos.socialC This user is from outside of this forum
                                  citizen428@chaos.socialC This user is from outside of this forum
                                  citizen428@chaos.social
                                  wrote last edited by
                                  #60

                                  @jwo Technically it's called an ill-advised use of my time that should never have happened, but yeah.

                                  jwo@mastodonczech.czJ 1 Reply Last reply
                                  0
                                  • citizen428@chaos.socialC citizen428@chaos.social

                                    @jwo Technically it's called an ill-advised use of my time that should never have happened, but yeah.

                                    jwo@mastodonczech.czJ This user is from outside of this forum
                                    jwo@mastodonczech.czJ This user is from outside of this forum
                                    jwo@mastodonczech.cz
                                    wrote last edited by
                                    #61

                                    @citizen428 Well, something like this is provided as a quasi-standard Kotlin/Ktor library IIRC.

                                    citizen428@chaos.socialC 1 Reply Last reply
                                    0
                                    • raymaccarthy@mastodon.ieR raymaccarthy@mastodon.ie

                                      @citizen428
                                      Macros are a really bad idea that should never be used in C. They are unfortunately needed in Assembler, but assembler, other than to boot strap a compiler is not needed for the last 30 years. Not even on microcontrollers (see Forth and JAL).

                                      citizen428@chaos.socialC This user is from outside of this forum
                                      citizen428@chaos.socialC This user is from outside of this forum
                                      citizen428@chaos.social
                                      wrote last edited by
                                      #62

                                      @raymaccarthy I would have thought the "extremely bad idea" cartoon in the first image made it clear that I agree with this. But this is chaos.social and "Spaß am Gerät" (loosely "Fun with the device) is basically the CCC motto.

                                      1 Reply Last reply
                                      0
                                      • phantasus@fedi.atP phantasus@fedi.at

                                        @overflo @citizen428 Kinky geeks wäre mindestens mit Seilen. Das ist nur vanilla "kreativ".

                                        citizen428@chaos.socialC This user is from outside of this forum
                                        citizen428@chaos.socialC This user is from outside of this forum
                                        citizen428@chaos.social
                                        wrote last edited by
                                        #63

                                        @phantasus @overflo Woher weisst du dass hier keine Seile involviert waren?

                                        1 Reply Last reply
                                        0
                                        • sashin@veganism.socialS sashin@veganism.social

                                          @citizen428 I did this with rust before!

                                          citizen428@chaos.socialC This user is from outside of this forum
                                          citizen428@chaos.socialC This user is from outside of this forum
                                          citizen428@chaos.social
                                          wrote last edited by
                                          #64

                                          @sashin Rust having proper macros makes this a lot easier, see e.g. https://maud.lambda.xyz

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


                                          • Login

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