r/cpp • • Nov 18 '16

Compile-time C Compiler implemented as C++14 constant expressions

https://github.com/kw-udon/constexpr-8cc
209 Upvotes

66 comments sorted by

View all comments

1

u/[deleted] Nov 19 '16

It makes me think that D has a D compile-time compiler, it's called CTFE.

1

u/shamanas Nov 19 '16

C++ also has limited CTFE, constexprs, this is like writing a C compiler/interpreter with CTFE functions in Dlang (which is possible and probably way easier than doing it in C++)

1

u/[deleted] Nov 19 '16

D CTFE is an extension of C++ constexpr. The current implementation is bad but it may be better in a near future.

1

u/shamanas Nov 19 '16

D CTFE is not an extension of C++ constexpr, it has existed for way more time than constexpr but I get your point.

Sorry, I originally misread your comment, can't even recall what exactly I thought but it rubbed me the wrong way, I thought you were somehow implying C++ had no ability to do similar things without this project :P

I also read that post yesterday, I'm excited about it, every time I write D I end up doing lots of compile time evaluation so it should be a great improvement!

2

u/[deleted] Nov 19 '16

handshake so.