티스토리 뷰
의외로 간단한 결론이 있다
머리가 안돌아갔나봄
abort 시킨다고 해서 실제로 실험해보니
$ ls -al a.out
-rwxr-xr-x 1 newpolaris wheel 26152 Jun 27 00:55 a.out*
newpolaris@Donghyuns-MacBook-Pro : /tmp
$ g++ test.cpp -fno-exceptions
newpolaris@Donghyuns-MacBook-Pro : /tmp
$ ls -al a.out
-rwxr-xr-x 1 newpolaris wheel 20800 Jun 27 00:55 a.out*
사이즈도 안줄고, exception도 나는데?
$ g++ test.cpp -fno-exceptions && ./a.out
libc++abi.dylib: terminating with uncaught exception of type std::length_error: vector
Abort trap: 6
Unfortunately the part about "-fno-exception" removing all exception handling code and turning all throws into aborts is wrong. Well - partially wrong. This is true when you compile the library in question (libstdc++v3) with this flag
newpolaris@Donghyuns-MacBook-Pro : /tmp
$ g++ test.cpp -fno-exceptions
test.cpp:9:5: error: cannot use 'try' with exceptions disabled
try {
^
1 error generated.
그러하다.
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크