我有這樣的:比較V8字符串(Node.js的插件)
if (!args[2]->IsString() || (*args[2]->ToString() != "true" && *args[2]->ToString() != "false")) {
Nan::ThrowTypeError("Third argument to 'replace-line' must be a string representing whether to find or replace.");
return;
}
但我得到一個編譯錯誤andwarnings:
../hello.cpp:49:58: error: comparison between distinct pointer types ‘v8::String*’ and ‘const char*’ lacks a cast [-fpermissive]
../hello.cpp:49:92: warning: comparison with string literal results in unspecified behaviour [-Waddress]
if (!args[2]->IsString() || (*args[2]->ToString() != "true" && *args[2]->ToString() != "false")) {
我怎麼能正確地比較普通的C弦弦V8?