1. 19
  1.  

    1. 3

      Why bother to do the function pointers in members thing if you have to pass self as an argument anyway? Instead of json->advance(json), just do json_advance(json).

      1. 1

        For the sake of thinkering, attaching functions to structures and using these methods

      2. 2

        the most surprising thing I got out of this post was the existence of the # preprocessor operator. I didn’t know this existed! led me to review the directives in the standard. neat stuff.

        1. 2

          You can indeed do some crazy syntax hacking with that feature! BTW, the example is wrong — it does actually give you the JSON string you’d expect.

          1. 1

            I missed the {} inside of the resulting string but yes it returns the exact input only stringified:

            char *raw_json = JSON({ "array" : [ [], {}] });
            

            This expands into:

            char *raw_json = "{ \"array\" : [[], {}] }";