Skip to content

Instantly share code, notes, and snippets.

@amfern
Last active August 31, 2015 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amfern/2377e9a3cd1ccc0186ea to your computer and use it in GitHub Desktop.
Save amfern/2377e9a3cd1ccc0186ea to your computer and use it in GitHub Desktop.
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)
#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