c++ Programming Glossary: situations
In C++, why use static_cast<int>(x) instead of (int)x? http://stackoverflow.com/questions/103512/in-c-why-use-static-castintx-instead-of-intx see there is no easy way to distinguish between the two situations without knowing a lot about all the classes involved. The second..
How do malloc() and free() work? http://stackoverflow.com/questions/1119134/how-do-malloc-and-free-work This is a rather graceful behaviour. I have also seen situations where a runnaway pointer somewhere has overwritten data in the..
What are copy elision and return value optimization? http://stackoverflow.com/questions/12953127/what-are-copy-elision-and-return-value-optimization named return value optimization What do they imply In what situations can they occur What are limitations If you were referenced to.. to prevent extra potentially expensive copies in certain situations. It makes returning by value or pass by value feasible in practice..
throwing exceptions out of a destructor http://stackoverflow.com/questions/130117/throwing-exceptions-out-of-a-destructor . The user of your class can then potentially handle these situations by using the public methods and catching any potential exceptions...
Uses of C comma operator http://stackoverflow.com/questions/1613230/uses-of-c-comma-operator
static const vs #define http://stackoverflow.com/questions/1637332/static-const-vs-define s are that they can be scoped and they can be used in situations where a pointer to an object needs to be passed. I don't know..
When should you use 'friend' in C++? http://stackoverflow.com/questions/17434/when-should-you-use-friend-in-c people who say friend is not useful. It IS useful. In many situations you will have objects with data or functionality that are not..
Static linking vs dynamic linking http://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking linking over dynamic linking or visa versa in certain situations I've heard or read the following but I don't know enough on..
Why is volatile not considered useful in multithreaded C or C++ programming? http://stackoverflow.com/questions/2484980/why-is-volatile-not-considered-useful-in-multithreaded-c-or-c-programming variables modified by another thread all constitute such situations. So if you have a global int foo and foo is read by one thread.. thus foo should be declared volatile or for multithreaded situations accessed with memory fenced load which is probably a better..
Dynamically allocating an array of objects http://stackoverflow.com/questions/255612/dynamically-allocating-an-array-of-objects generated assignment operator is fine for nearly all situations but when RAW pointers are in play you need to pay attention...
When and why will an OS initialise memory to 0xCD, 0xDD, etc. on malloc/free/new/delete? http://stackoverflow.com/questions/370195/when-and-why-will-an-os-initialise-memory-to-0xcd-0xdd-etc-on-malloc-free-new changed to 0xFE . I assume that's because there could be situations where the fill operation would run past the end of the buffer..
What C++ Smart Pointer Implementations are available? http://stackoverflow.com/questions/5026197/what-c-smart-pointer-implementations-are-available std auto_ptr to allow copying and assignment in certain situations. Specifically it can be used to convert a non const std auto_ptr.. a few complaints about performance and overhead in some situations but I must have ignored them because I can't remember what the..
C++: When to use References vs. Pointers http://stackoverflow.com/questions/7058339/c-when-to-use-references-vs-pointers to use references or pointers in an API Naturally some situations need one or the other operator needs a reference argument but..
Singleton: How should it be used http://stackoverflow.com/questions/86582/singleton-how-should-it-be-used a correct Singleton they abuse the Pattern and use it in situations that are not appropriate replacing global variables with Singletons..
Smart Pointers: Or who owns you baby? [closed] http://stackoverflow.com/questions/94227/smart-pointers-or-who-owns-you-baby classes are used to implement those semantics What situations do you find them useful Lets keep 1 type of semantic ownership.. compile time. boost weak_ptr T Used with shared_ptr T . In situations where a cycle of pointers may happen. Usage Used to stop cycles..
|