strcmp throws JS exception when comparing identical strings
rodrigorgs opened this issue · comments
The following code gives an error on the second strcmp
:
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char *s1 = "Hello";
char *s2 = "Bye!!";
cout << strcmp(s1, s2) << endl; // ok
cout << strcmp(s1, s1) << endl; // ERROR!!!
return 0;
}
The error (on JavaScript console) is TypeError: Cannot read property 'v' of undefined
.
Curiously, the first strcmp
, which compares different strings, works as intended.
Tested on https://felixhao28.github.io/JSCPP/.
Fixed. Thanks for reporting!