libstdc++

std::throw_with_nested expects polymorphic type in C++11?

旧巷老猫 提交于 2019-12-01 15:20:03
Why does this not compile (tried with Clang 3.4.2 and GCC versions 4.7.4, 4.8.3 and 4.9.1): #include <exception> struct E { E(int) {} }; int main() { std::throw_with_nested(E(42)); return 0; } Errors from GCC 4.9.1: In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.1/include/g++-v4/exception:163:0, from test.cpp:1: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.1/include/g++-v4/bits/nested_exception.h: In instantiation of 'static const std::nested_exception* std::__get_nested_helper<_Ex>::_S_get(const _Ex&) [with _Ex = E]': /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.1/include/g++-v4/bits/nested

is libstdc++ reentrant library?

不想你离开。 提交于 2019-12-01 11:01:20
I am using libstdc++ on MAC for developing extensions for firefox. I am getting crashes inside libstdc+ library when I am referring to it across multiple firefox extensions. I was thinking whether libstdc++ for XCode compiler is reentrant or not. If not, is there any version of libstdc++ is available with is reentrant ? See the HOWTO at http://www.cs.huji.ac.il/~etsman/Docs/gcc-3.4-base/libstdc++/html/17_intro/howto.html , specifically the section entitled "The Standard C++ library and multithreading". 来源: https://stackoverflow.com/questions/4036520/is-libstdc-reentrant-library

is libstdc++ reentrant library?

纵然是瞬间 提交于 2019-12-01 09:38:26
问题 I am using libstdc++ on MAC for developing extensions for firefox. I am getting crashes inside libstdc+ library when I am referring to it across multiple firefox extensions. I was thinking whether libstdc++ for XCode compiler is reentrant or not. If not, is there any version of libstdc++ is available with is reentrant ? 回答1: See the HOWTO at http://www.cs.huji.ac.il/~etsman/Docs/gcc-3.4-base/libstdc++/html/17_intro/howto.html , specifically the section entitled "The Standard C++ library and

/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found

落爺英雄遲暮 提交于 2019-12-01 05:28:28
I am trying to run appium tests. However I get error saying what: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found I am using RedHat6.6. When I run: strings /usr/lib/libstdc++.so.6 | grep GLIBC I get this: GLIBC GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBC_2.0 GLIBC_2.3 GLIBC_2.4 GLIBC_2.1 GLIBC_2.1.3 GLIBC_2.3.2 GLIBC_2.2 GLIBCXX_FORCE_NEW GLIBCXX_DEBUG_MESSAGE_LENGTH Is it possible to get GLIBCXX_3.4.15 for RedHat6.6?

Unnecessary emptying of moved-from std::string

假如想象 提交于 2019-12-01 03:47:59
Both libstdc++ and libc++ makes moved-from std::string object empty, even if the original stored string is short and short string optimization is applied. It seems to me that this emptying makes an additional and unnecessary runtime overhead . For instance, here is the move constructor of std::basic_string from libstdc++: basic_string(basic_string&& __str) noexcept : _M_dataplus(_M_local_data(), std::move(__str._M_get_allocator())) { if (__str._M_is_local()) traits_type::copy(_M_local_buf, __str._M_local_buf, _S_local_capacity + 1); else { _M_data(__str._M_data()); _M_capacity(__str._M

Is this code really undefined, as Clang seems to indicate?

我的未来我决定 提交于 2019-12-01 02:53:54
I switched on -fsanitize=undefined on my project which uses Catch, the unit testing library. One line from Catch was signalled as causing undefined behaviour by this flag. I managed to make an isolated example: #include <iomanip> #include <sstream> int main() { std::ostringstream os; os << "0x" << std::setfill('0') << std::hex; } Compiled with: clang++ -fsanitize=undefined main.cpp If I run this, the following print is given: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/bits/ios_base.h:96:24: runtime error: load of value 4294967221, which is not a valid

Is this code really undefined, as Clang seems to indicate?

混江龙づ霸主 提交于 2019-11-30 22:55:02
问题 I switched on -fsanitize=undefined on my project which uses Catch, the unit testing library. One line from Catch was signalled as causing undefined behaviour by this flag. I managed to make an isolated example: #include <iomanip> #include <sstream> int main() { std::ostringstream os; os << "0x" << std::setfill('0') << std::hex; } Compiled with: clang++ -fsanitize=undefined main.cpp If I run this, the following print is given: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../..

How to configure libstdc++ with GCC 4.8?

耗尽温柔 提交于 2019-11-30 19:36:08
A while back, I decided to upgrade to GCC 4.8 in order to get an early start on some c++11 features. I got a bit sidetracked, though, and didn't really put any of the new features to use until a project a few days ago (the new compiler seemed to have been working fine, but it may just be because I wasn't utilizing any new functionality.) In this new project, when I compiled with the =std=c++11 flag, I had no problems. However, at runtime, I get the error: ./main: /usr/lib/i386-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.18' not found (required by ./main)` I assume that there is a problem

Does std::vector::emplace() really offer the strong exception guarantee in the face of a throwing move constructor/assignment operator?

让人想犯罪 __ 提交于 2019-11-30 19:14:12
According to cppreference.com , std::vector::emplace() offers the strong exception guarantee unconditionally: If an exception is thrown (e.g. by the constructor), the container is left unmodified, as if this function was never called (strong exception guarantee). However, this doesn't seem to be the case in practice with GCC 7.1.1. The following program: #include <iostream> #include <vector> struct ugly { int i; ugly(int i) : i{i} { } ugly(const ugly& other) = default; ugly& operator=(ugly&& other) { if (other.i == 3) { throw other.i; } i = other.i; return *this; } ugly& operator=(const ugly&

How can I programatically determine where my C++ runtime libraries are?

无人久伴 提交于 2019-11-30 18:44:09
问题 I'm building C++11 with GCC 4.8 on CentOS 6 using "hax", then deploying on arbitrary CentOS 6 targets (on which anything C++-related out of the box will have been built as C++03 with GCC 4.3) (ref) . To make this work, I'm going to ship all of my third-party libs as well as the g++ runtimes, and rpath my executables so the newer libs are assuredly found in the proper place. For the runtimes, by my count I need to ship libstdc++ and libgcc_s . But I need to know where they are on my build