Related to Herb Sutter's "Guru of the Week" C++ programming challenges.
Questions tagged [gotw]
18 questions
1
vote
3 answers
How to fix this typical exception unsafe code?
According to GOTW #56, there is a potential classic memory leak and exception safety issues in the following code:
// In some header file:
void f( T1*, T2* );
// In some implementation file:
f( new T1, new T2 );
The reason is that when we new T1,…

taocp
- 23,276
- 10
- 49
- 62
0
votes
0 answers
"using namespace x" inside namespace in header
If I've understood Raymond Chen correctly, this is dangerous, but I can't work out exactly why. http://gotw.ca/publications/migrating_to_namespaces.htm
To be clear, this is not about global namespace pollution due to headers injecting entire…

Roddy
- 66,617
- 42
- 165
- 277
0
votes
0 answers
Undefined reference to Pimpl destructor only with clang on Linux
Inspired by GoTW 101, I decided to try and apply the Pimpl idiom to a part of a library I'm working on using the pimpl wrapper described there.
However, when trying to compile, I get an undefined reference to the destructor of that Pimpl class. This…

dtruby
- 1,775
- 2
- 12
- 9