4 ms·
It actually would! There are a handful of base-10 arbitrary precision arithmetic implementations in the preprocessor[1], and modern continuation-passing style m
by foundry27 2y ago
It actually would! There are a handful of base-10 arbitrary precision arithmetic implementations in the preprocessor[1], and modern continuation-passing style macro metaprogramming[2] makes it straightforward to write a function like factorial once you get the syntax and semantics down.
Libraries like Boost.Preprocessor can’t be taken as an example of “cutting edge” preprocessor metaprogramming. It set a very low bar, and IMO has stifled a lot of developer creativity.
[1] https://github.com/rofl0r/chaos-pp/tree/master/chaos/preprocessor/arbitrary https://github.com/rofl0r/chaos-pp/tree/master/chaos/preproc...
[2] https://github.com/rofl0r/order-pp/blob/master/example/fibonacci.c https://github.com/rofl0r/order-pp/blob/master/example/fibon...
- gpderetta 2y agoI Remember Chaos and Order (20 years ago... now I feel old). The reason that they remained niche is that at the time MSVC had an extremely non confirming preprocessor and advanced PP libraries just weren't viable there. Boos.PP was the most advanced you could get while staying portable.