diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -23,7 +23,12 @@ #include <string> static std::array<sforth::cell, 1024> dict; -static auto fth = new (dict.data()) sforth::forth; +static sforth::forth *fth = + [] constexpr { + fth = new (dict.data()) sforth::forth; + sforth::initialize<&fth>(dict.end()); + return fth; + }(); static bool parse_stream(sforth::forth *, std::istream&, bool say_okay = false); @@ -31,7 +36,6 @@ int main(int argc, const char *argv[]) { std::span args (argv + 1, argc - 1); - sforth::initialize<&fth>(dict.end()); fth->add(".", [](auto) { char buf[32] = {}; std::to_chars(buf, buf + sizeof(buf), fth->pop(), fth->base); |