On 03/24/2018 09:53 AM, H. S. Teoh wrote:
On Sat, Mar 24, 2018 at 01:42:56AM -0700, Walter Bright via Digitalmars-d wrote:
[...]
I can't recall ever seeing anyone else use this technique (other than
Nick!), but it works and isn't that bad.

It's not all that uncommon.  I've worked with projects (and still do)
where code is generated by a tool at build time, and then #include'd by
other source code.  Any project that uses lex/yacc (or their clones
flex/bison) does this. One of my own recent projects involved a clever
(IMO) trick of using the C preprocessor on a C header file (truetype, to
be precise) to generate D code that then gets compiled by a D compiler,
by suitably (re)defining certain macros.


And the excellent, classic book "The Pragmatic Programmer" promoted it as a technique worth having in one's toolbelt (That book, along with "Writing Solid Code", left a big lasting impact on me.)

IIRC, in the earlier days of Gameboy Advance homebrew (back when I still had time for that sort of thing!) it was also the first common technique for including images/audio in a ROM image. (Until other tools were developed to handle the task better.)

Reply via email to