Last active
August 31, 2015 13:14
-
-
Save amfern/2377e9a3cd1ccc0186ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_CFLAGS := -Wall | |
LOCAL_CPPFLAGS := -Wno-write-strings -Wall -std=c++11 -fexceptions -frtti | |
LOCAL_SRC_FILES := \ | |
test.cpp | |
LOCAL_MODULE := test_app | |
LOCAL_MODULE_TAGS := optional | |
LOCAL_SHARED_LIBRARIES := \ | |
libutils \ | |
libcutils | |
include external/libcxx/libcxx.mk | |
include $(BUILD_EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LOG_TAG "TEST_APP" | |
#include <utils/Log.h> | |
#include <stdexcept> | |
#include <fstream> | |
#include <iostream> | |
int main(int, char **) | |
{ | |
ALOGD("test app"); | |
try { | |
throw std::ios_base::failure("miau"); | |
} catch(std::exception &e) { | |
ALOGD("caught self thrown std::ios_base::failure"); | |
} | |
try { | |
std::ofstream out; | |
out.exceptions( std::ofstream::failbit | std::ofstream::badbit ); | |
out.open("bad_path"); | |
} catch(std::ios_base::failure &e) { | |
ALOGD("caught std::ios_base::failure"); | |
} catch(std::__1::ios_base::failure &e) { | |
ALOGD("caught std::__1::ios_base::failure"); | |
} catch(std::exception &e) { | |
ALOGD("caught std::exception"); | |
} catch(...) { | |
ALOGD("caught all"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment