Closed yurivict closed 3 years ago
The rest seems to be C++-safe, but js_try
is not.
It works for me on Linux in both GCC and clang. Which compiler version are you using?
$ c++ --version
FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on LLVM 8.0.0)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
MuJS is a C project. There are many other things that don't work if you try to compile it as C++.
You can use the js_try() macro on C++ if you pass the -fpermissive flag to the C++ compiler. Unfortunately the typedef and C language voodoo for setjmp make it very difficult to return a jmp_buf with portable code that also builds as C++. If you can think of a way, I'm all ears.
This testcase:
fails to compile on FreeBSD: