On 3/23/2018 11:09 AM, Manu wrote:
Like, in this particular project, being able to generate all tables at
compile time is the thing that distinguishes the D code from the C++
code; it's the *whole point*... If I have to continue to generate
tables offline and paste big tables of data in the source code (and
then re-generate them manually when I change something); then
situation is identical to C++, therefore, stick with C++.\

This file:

  https://github.com/dlang/dmd/blob/master/src/dmd/backend/optabgen.c

computes tables, and writes several tables out to several .c files, which are then #include'd into the main build. It all happens automagically using the makefile:

  https://github.com/dlang/dmd/blob/master/src/win32.mak#L420

I've been using this technique continually since the early 1980's :-)

Some IDEs have problems with it, because they cannot support layered builds like this, but good old make does it just fine.

I can't recall ever seeing anyone else use this technique (other than Nick!), but it works and isn't that bad.

The dmd front end used to do this as well, but that has since been replaced with CTFE since it was converted to D.

Reply via email to