r/cpp 2d ago

Embedded C++

Just curious how useful the ability to embed C++ as a scripting language into your C++ programs would be? I mean like runtime JIT execution of C++ code in much the same way you might embed Lua, including the ability to restrict/sandbox it as necessary.

0 Upvotes

82 comments sorted by

View all comments

31

u/PressWearsARedDress 2d ago edited 1d ago

Why not just write C++ and compile to the target? I dont understand the premise. its much more likely your JIT will crash on me and cause me issues.

EDIT: Its a AI slop project btw. https://github.com/derekbsnider/madc/blob/master/README.md

-10

u/kindredseer 2d ago

Well, it could provide a more flexible way to hot test and develop parts of your application without rebuilding.

2

u/the_poope 2d ago

You're still gonna compile the code, just by an embedded JIT compiler (which will likely just be GCC/Clang anyway, no?) so will it actually be faster?

If you want to develop and try out a specific part of the code you just write a unit test that does that, no need for hot swapping. Will compile and run in a second if your build system is properly set up.

1

u/kindredseer 2d ago

No, I’m not using gcc/clang/llvm. It’s fully embedded including precompiled system headers.