3 ms·
I like to use compile time code to generate fixed tables, like these: https://github.com/dlang/dmd/blob/master/src/dmd/backend/oper.d#L595 https://github.com/d
by WalterBright 5y ago
I like to use compile time code to generate fixed tables, like these:
https://github.com/dlang/dmd/blob/master/src/dmd/backend/oper.d#L595 https://github.com/dlang/dmd/blob/master/src/dmd/backend/ope...
Notice how a static immutable array is created by a lambda at compile time. The lambda never appears in the executable. Before D, I'd use a separate C executable to generate the tables, which were then #include'd.
The lambdas can also include sanity checks:
https://github.com/dlang/dmd/blob/master/src/dmd/backend/oper.d#L538 https://github.com/dlang/dmd/blob/master/src/dmd/backend/ope...
- deleted 5y ago[deleted]