c++ Programming Glossary: my
Why is processing a sorted array faster than an unsorted array? http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array thought was that sorting brings the data into cache but my next thought was how silly that is because the array was just..
Why is “using namespace std;” considered bad practice? http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice I've been told by others on numerous occasions that my teacher was wrong in saying that we should have using namespace..
What are the rules about using an underscore in a C++ identifier? http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier MFC background you'll probably use m_foo . I've also seen myFoo occasionally. C# or possibly just .NET seems to recommend.. don't start identifiers with underscores. New addition to my rule Don't use double underscores anywhere which is easy as.. After doing research on this article I no longer end my identifiers with '_t' as this is reserved by the POSIX standard...
What is move semantics? http://stackoverflow.com/questions/3106110/what-is-move-semantics rvalue reference you might ask. We don't need it here is my answer Note that we pass the parameter that by value so that..
What is the copy-and-swap idiom? http://stackoverflow.com/questions/3279543/what-is-the-copy-and-swap-idiom code is needed to manage one resource correctly what if my class manages more than one While this may seem to be a valid..
When should static_cast, dynamic_cast and reinterpret_cast be used? http://stackoverflow.com/questions/332030/when-should-static-cast-dynamic-cast-and-reinterpret-cast-be-used no other cast can. This is mostly a kludge though and in my mind is just another reason to avoid C style casts. share improve..
What can I use to profile C++ code in Linux? http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux the process of optimizing. What tool can I use to pinpoint my slow code c unix profiling share improve this question ..
What is The Rule of Three? http://stackoverflow.com/questions/4172722/what-is-the-rule-of-three copy assignment operator When do I need to declare them myself How can I prevent my objects from being copied c copy constructor.. When do I need to declare them myself How can I prevent my objects from being copied c copy constructor assignment operator..
How do I use arrays in C++? http://stackoverflow.com/questions/4810664/how-do-i-use-arrays-in-c x as the first argument. That is a little too terse for my taste and it also makes template argument deduction a bit harder..
Are global variables bad? http://stackoverflow.com/questions/484635/are-global-variables-bad variables bad In C C are global variables as bad as my professor thinks they are c c global variables share improve..
Pretty-print C++ STL containers http://stackoverflow.com/questions/4850473/pretty-print-c-stl-containers accept it but in the meantime I'd like to post the code myself for reference. Update Sven has now posted his code below.. stream using delimiters from delimiters std pair tuple_dummy_t tuple_dummy_t . namespace pretty_print struct tuple_dummy_t.. delimiters from delimiters std pair tuple_dummy_t tuple_dummy_t . namespace pretty_print struct tuple_dummy_t Just if you..
Why can templates only be implemented in the header file? http://stackoverflow.com/questions/495021/why-can-templates-only-be-implemented-in-the-header-file You will only be able to use Foo with int or float If my explanation isn't clear enough you can have a look at the C..
What are the barriers to understanding pointers and what can be done to overcome them? http://stackoverflow.com/questions/5727/what-are-the-barriers-to-understanding-pointers-and-what-can-be-done-to-overcome and some comments where appropriate. I chose Delphi since my other main programming language C# does not exhibit things like.. reader and then I free it. Lastly I clear the address from my variable. Memory layout h v before free ttttNNNNNNNNNN 1234My..
Can a local variable's memory be accessed outside its scope? http://stackoverflow.com/questions/6441218/can-a-local-variables-memory-be-accessed-outside-its-scope can happen in the real world no problem. There is no mysterious force that causes your book to disappear when you are.. are no longer authorized to be in the room. Nor is there a mysterious force that prevents you from entering a room with a.. a contract with them that said if I try to sneak back into my room later you are required to stop me. Rather you signed a..
How to generate a stacktrace when my gcc C++ app crashes http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes to generate a stacktrace when my gcc C app crashes When my c app crashes I would like to generate.. to generate a stacktrace when my gcc C app crashes When my c app crashes I would like to generate a stacktrace. I already.. I already asked this but I guess I needed to clarify my needs. My app is being run by many different users and it also..
Where do I find the current C or C++ standard documents? http://stackoverflow.com/questions/81656/where-do-i-find-the-current-c-or-c-standard-documents answers or Google for download locations . However in my opinion even though the draft versions might be very close to..
C++ Singleton design pattern http://stackoverflow.com/questions/1008019/c-singleton-design-pattern It seems like there is a problem in the implementation. My main question is how do I implement it in the right way c design..
Why is processing a sorted array faster than an unsorted array? http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array sum sum with a similar but less extreme result. My first thought was that sorting brings the data into cache but..
Pointer vs. Reference http://stackoverflow.com/questions/114180/pointer-vs-reference pointers reference share improve this question My rule of thumb is Use pointers if you want to do arithmetic with..
Storing C++ template function definitions in a .CPP file http://stackoverflow.com/questions/115703/storing-c-template-function-definitions-in-a-cpp-file std strings so those definitions mean the app will link. My question is is this a nasty hack or will this work with other..
Most vexing parse: why doesn't A a(()); work? http://stackoverflow.com/questions/1424510/most-vexing-parse-why-doesnt-a-a-work doing the same leads to a compile error A a compile error My question is why Yes I'm very well aware that the correct 'workaround'..
Unnamed/anonymous namespaces vs. static functions http://stackoverflow.com/questions/154469/unnamed-anonymous-namespaces-vs-static-functions created in as if you had an implicit using clause to them. My question is why or when would this be preferable to using static..
How come a non-const reference cannot bind to a temporary object? http://stackoverflow.com/questions/1565600/how-come-a-non-const-reference-cannot-bind-to-a-temporary-object and Nothing is said about non const references though . My additional question . Does following assignment extend the lifetime..
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 of volatile in multi threaded programming contexts. My understanding is this any time a variable may be changed outside..
How to implement big int in C++ http://stackoverflow.com/questions/269268/how-to-implement-big-int-in-c simple to implement the various comparison operators. My main concern is how I would implement things like addition and..
Determine if two rectangles overlap each other? http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other in this question but I am not having very much luck. My current implementation does the following Gets all the vertices..
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 on other operating systems such as Linux or VxWorks Why My understanding is this only occurs in Win32 debug configuration..
std::wstring VS std::string http://stackoverflow.com/questions/402283/stdwstring-vs-stdstring directly tied to unicode. On Linux Let's take a Linux OS My Ubuntu system is already unicode aware. When I work with a char..
Pretty-print C++ STL containers http://stackoverflow.com/questions/4850473/pretty-print-c-stl-containers posted his code below which I made the accepted answer. My own code uses container type traits which work for me but may.. std char_traits TChar and TChar char or wchar_t and MyDelims needs to be defined for TChar. Usage cout pretty_print.. defined for TChar. Usage cout pretty_print custom_delims MyDelims x . struct custom_delims_base virtual ~custom_delims_base..
What are the differences between pointer variable and reference variable in C++? http://stackoverflow.com/questions/57483/what-are-the-differences-between-pointer-variable-and-reference-variable-in-c implement algorithms and data structures. Interesting read My alltime favorite C FQA lite References vs. Pointers An Introduction.. points to can be on the stack or heap. Ditto a reference. My claim in this statement is not that a pointer must point to..
OpenCV 2.3 C++ Visual Studio 2010 http://stackoverflow.com/questions/7011238/opencv-2-3-c-visual-studio-2010 trying to use opencv 2.3 with Visual Studio 2010 Express. My code is from example #include stdafx.h #include highgui.h int..
How to generate a stacktrace when my gcc C++ app crashes http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes asked this but I guess I needed to clarify my needs. My app is being run by many different users and it also runs on..
Why is one loop so much slower than two loops? http://stackoverflow.com/questions/8547778/why-is-one-loop-so-much-slower-than-two-loops and the double loop example takes only 1.9 seconds. My question is Please refer to the my rephrased question at the..
What is “rvalue reference for *this”? http://stackoverflow.com/questions/8610571/what-is-rvalue-reference-for-this to this but I'm also not getting much examples from there. My questions would be What is this feature about c c 11 move semantics..
Singleton: How should it be used http://stackoverflow.com/questions/86582/singleton-how-should-it-be-used use a Singleton How do you implement a Singleton correctly My hope for this article is that we can collect together in a single.. this is what I use but probably has problems. I like Scott Myers handling of the subject in his books Effective C Good Situations.. constructed before the constructor of B is called. class MySingleton private Private Constructor MySingleton Stop the compiler..
|