Skip to content

Comment on Using the C preprocessor as an HTML templating engine

Comments

Seems like a bad idea, given that the CPP and HTML have a fair number of overlapping tokens (e.g. `#` for both URL fragments and macro beginnings).

Why not use SSI[1]? It's inspired by the CPP's syntax, but is supported directly by most HTTP servers (and is more powerful, to boot).

[1]: https://en.wikipedia.org/wiki/Server_Side_Includes

Why not use SSI[1]?

Because hacking is fun, and it's still fun if it's a bad idea

Thank you for saying this!

# is only processed by cpp when it's the first non-whitespace character in a line so that shouldn't be an issue in the real world. But, yeah, SSI.

True. Maybe < and > would have been better examples, although one could argue those are optional :-)

Yes, although if you use #define or C comments or several other stuff then it can potentially cause a problem due to it is not a C syntax and is not expected.

Completely forgot about SSI! What a cool feature

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.