Can full CPP standard library be used if exceptions are disabled?

Viewed 73

I am writing native code on Android and CPP exceptions are disabled by default. I could simply enable them but I love leaving settings to default. So I wonder if I can use all features of libc++ if exceptions are disabled?

Here is one code example:

std::__fs::filesystem::directory_iterator it("/does/not/exist");

The libc++ is compiled with exceptions. So this line will throw an exception. But I cannot catch it because my code is compiled without exceptions. My program will crash because an exception of type filesystem_error is thrown and I did not catch it:

terminating with uncaught exception of type std::__ndk1::__fs::filesystem::filesystem_error: filesystem error: in directory_iterator::directory_iterator(...): No such file or directory [/does/not/exist]
/buildbot/src/android/ndk-release-r23/toolchain/llvm-project/libcxx/../../../toolchain/llvm-project/libcxxabi/src/abort_message.cpp:72: abort_message: assertion "terminating with uncaught exception of type std::__ndk1::__fs::filesystem::filesystem_error: filesystem error: in directory_iterator::directory_iterator(...): No such file or directory [/does/not/exist]" failed
Aborted 

So my question is if it is possible to use full libc++ if exceptions are disabled in my code?

Edit: I am building a native standalone executable using ndk-build.

0 Answers
Related