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).
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.
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 dojson_advance(json).For the sake of thinkering, attaching functions to structures and using these methods
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.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.
I missed the
{}inside of the resulting string but yes it returns the exact input only stringified:This expands into: