I have a constructor in some C++ Android NDK code which is used in a larger Android project. This constructor was missing some simple bounds checks on some parameters, which I've added. If they are invalid, object initialization doesn't make sense. Unfortunately, it seems exceptions are not supported in the NDK . Returning NULL
isn't accepted by the compiler either(I get an error as -Wreturn-type
is enabled), and it seems wrong anyway.
This answer provides an overview of other ways of signalling failure if exceptions aren't an option, but as they are all quite hacky. Since the android NDK doesn't provide exceptions, I thought it might provide some other method. Is that the case, or do I have to resort to something hacky?