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.
  • 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
                      • jwo@mastodonczech.czJ jwo@mastodonczech.cz

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

                        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
                        #65

                        @jwo Yup, kotlinx.html. Rust has https://maud.lambda.xyz. There's plenty of precedent, but that doesn't make this specific late night digression a good idea.

                        1 Reply Last reply
                        0
                        • m3tti@functional.cafeM m3tti@functional.cafe

                          @citizen428 if it works don't fix it i guess. Somehow it feels like react but without the reactivity 😄

                          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
                          #66

                          @m3tti Depends on your definition of "works" 😄 I'd not be inclined to actually use this.

                          1 Reply Last reply
                          0
                          • schaf@netzkms.deS schaf@netzkms.de

                            @citizen428 old and busted: php as a c preprocessor¹

                            hot and new: c preprocessor as a php

                            ¹ https://stackoverflow.com/questions/396644/replacements-for-the-c-preprocessor/16256052#16256052

                            Edit: Originalquelle verlinkt

                            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
                            #67

                            @schaf That's exactly what the lolsob emoji is for.

                            Link Preview Image
                            1 Reply Last reply
                            0
                            • joe@f.duriansoftware.comJ joe@f.duriansoftware.com

                              @jrose @citizen428 to their credit, they did say it was a bad idea

                              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
                              #68

                              @joe @jrose I thought it was rather obvious that this is not a serious suggestion, then I added the cartoon just in case.

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

                                @joe @jrose I thought it was rather obvious that this is not a serious suggestion, then I added the cartoon just in case.

                                jrose@social.belkadan.comJ This user is from outside of this forum
                                jrose@social.belkadan.comJ This user is from outside of this forum
                                jrose@social.belkadan.com
                                wrote last edited by
                                #69

                                @citizen428 @joe Yeah, sorry, I didn’t mean it as a mark against you either! It just rang a bell, having run into people attempting to do even a less silly thing.

                                1 Reply Last reply
                                0
                                • ics@tau-ceti.spaceI ics@tau-ceti.space

                                  @citizen428 @eniko Impressive! 😳😍

                                  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
                                  #70

                                  @ics @eniko

                                  Not the first word I’d use 😂

                                  ics@tau-ceti.spaceI 1 Reply Last reply
                                  0
                                  • citizen428@chaos.socialC citizen428@chaos.social

                                    @ics @eniko

                                    Not the first word I’d use 😂

                                    ics@tau-ceti.spaceI This user is from outside of this forum
                                    ics@tau-ceti.spaceI This user is from outside of this forum
                                    ics@tau-ceti.space
                                    wrote last edited by
                                    #71

                                    @citizen428 @eniko The first words were "WTF????" - that's why the first emoji 😂😂

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

                                      @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 This user is from outside of this forum
                                      necrophcodr@layer8.spaceN This user is from outside of this forum
                                      necrophcodr@layer8.space
                                      wrote last edited by
                                      #72

                                      @citizen428 I mean it has simple uses too, like adding simple include statements in any file, or, as you've shown, macros.

                                      I've used it to make a lockfile for my Containerfile, and I'd just build using cpp -E <file> | docker build -f- <...>

                                      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)

                                        ryanc@infosec.exchangeR This user is from outside of this forum
                                        ryanc@infosec.exchangeR This user is from outside of this forum
                                        ryanc@infosec.exchange
                                        wrote last edited by
                                        #73

                                        @citizen428 I highly recommend combining this with a MAP macro.

                                        citizen428@chaos.socialC 1 Reply Last reply
                                        0
                                        • ryanc@infosec.exchangeR ryanc@infosec.exchange

                                          @citizen428 I highly recommend combining this with a MAP macro.

                                          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
                                          #74

                                          @ryanc Please don’t give me ideas 😂

                                          ryanc@infosec.exchangeR 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