c++ Programming Glossary: am
What is a “translation unit” in C++ http://stackoverflow.com/questions/1106149/what-is-a-translation-unit-in-c is a &ldquo translation unit&rdquo in C Hello everybody I am reading at the time the Effective C written by Meyers and came.. reading at the time the Effective C written by Meyers and came across the term translation unit . Could somebody please give.. exactly it is 2 When should I consider using it when programming with C 3 If it is related only to C or it can be used with..
System(“pause”); - Why is it wrong? http://stackoverflow.com/questions/1107705/systempause-why-is-it-wrong understand The command system pause is taught to new programmers as a way to pause a program and wait for a keyboard input.. is taught to new programmers as a way to pause a program and wait for a keyboard input to continue. However it seems.. However it seems to be frowned on by many veteran programmers as something that should not be done in varying degrees...
CSV parser in C++ http://stackoverflow.com/questions/1120140/csv-parser-in-c promising http www.boost.org doc libs 1_35_0 libs spirit example fundamental list_parser.cpp I've never used Boost's Spirit.. http www.boost.org doc libs 1_35_0 libs spirit example fundamental list_parser.cpp I've never used Boost's Spirit but am willing.. list_parser.cpp I've never used Boost's Spirit but am willing to try it. Is it overkill bloated or is it fast and..
Using std Namespace http://stackoverflow.com/questions/1265039/using-std-namespace std Namespace There seem to be different views on using 'using' with.. different views on using 'using' with respect to the std namespace. Some say use ' using namespace std ' other say don't.. with respect to the std namespace. Some say use ' using namespace std ' other say don't but rather prefix std functions..
How to pass objects to functions in C++? http://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c to pass objects to functions in C I am new to C programming but I have experience in Java. I need guidance.. to pass objects to functions in C I am new to C programming but I have experience in Java. I need guidance on how to.. Passing by pointer is virtually never advised. Optional parameters are best expressed as a boost optional and aliasing is..
What is the difference between an int and a long in C++? http://stackoverflow.com/questions/271076/what-is-the-difference-between-an-int-and-a-long-in-c difference between an int and a long in C Correct me if I am wrong int is 4 bytes with a range of values from 2 147 483 648.. this question It is implementation dependent. For example under Windows they are the same but for example on Alpha.. dependent. For example under Windows they are the same but for example on Alpha systems a long was 64 bits whereas..
C++ Timer function to provide time in nano seconds http://stackoverflow.com/questions/275004/c-timer-function-to-provide-time-in-nano-seconds space of nano seconds. As the API is a C class function I am using the timer.h to caculate the same #include ctime #include.. a C class function I am using the timer.h to caculate the same #include ctime #include cstdio using namespace std int main.. to caculate the same #include ctime #include cstdio using namespace std int main int argc char argv clock_t start double diff..
What is move semantics? http://stackoverflow.com/questions/3106110/what-is-move-semantics C 0x . Most of the new features made sense to me and I am actually excited about C 0x now with the exception of one. I.. I find it easiest to understand move semantics with example code. Let's start with a very simple string class which only.. memory ourselves we need to follow the rule of three . I am going to defer writing the assignment operator and only implement..
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 should static_cast dynamic_cast and reinterpret_cast be used I am reasonably proficient.. static_cast dynamic_cast and reinterpret_cast be used I am reasonably proficient in C but I do not have a lot of experience.. operators to convert pointers of one type to another. I am familiar with the risks and benefits of pointer casting as well..
std::wstring VS std::string http://stackoverflow.com/questions/402283/stdwstring-vs-stdstring wstring VS std string I am not able to understand the differences between std string and.. chars . The following code #include cstring #include iostream int main int argc char argv const char text olé const wchar_t.. using the local charset codepage on the machine. For example olé would be olé in a french localized Windows but would..
What is The Rule of Three? http://stackoverflow.com/questions/4172722/what-is-the-rule-of-three an object actually means. Let us consider a simple example class person std string name int age public person const.. Let us consider a simple example class person std string name int age public person const std string name int age name name.. std string name int age public person const std string name int age name name age age int main person a Bjarne Stroustrup..
What are access specifiers? Should I inherit with private, protected or public? http://stackoverflow.com/questions/5447498/what-are-access-specifiers-should-i-inherit-with-private-protected-or-public Should I inherit with private protected or public I am confused about the meaning of access modifiers with respect.. within that class Inside any member function of that same class . Moving ahead to type of access specifiers they are.. the class. No outside Access is allowed. An Source Code Example class MyClass public int a protected int b private int c..
When to use forward declaration? http://stackoverflow.com/questions/553682/when-to-use-forward-declaration to use forward declaration I am looking for the definition of when I am allowed to do forward.. declaration I am looking for the definition of when I am allowed to do forward declaration of a class in another class's..
OpenCV 2.3 C++ Visual Studio 2010 http://stackoverflow.com/questions/7011238/opencv-2-3-c-visual-studio-2010 2.3 with Visual Studio 2010 Express. My code is from example #include stdafx.h #include highgui.h int _tmain int argc.. 1 create a window to display the images cvNamedWindow mainWin CV_WINDOW_AUTOSIZE position the window cvMoveWindow.. cvMoveWindow mainWin 5 5 while 1 retrieve the captured frame img cvQueryFrame capture show the image in the window cvShowImage..
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 since they are drowned in the flood of discussions on programming forums To get this started since these are the ones I am.. forums To get this started since these are the ones I am searching for right now where are there good online resources.. at reasonable price and now the C11 standard. So as an example you search for NCITS ISO IEC 9899 2011 instead of ISO IEC..
Singleton: How should it be used http://stackoverflow.com/questions/86582/singleton-how-should-it-be-used C Good Situations to use Singletons not many Logging frameworks Thread recycling pools C Singleton Limitation Single.. know Because everyone else is doing it See cargo cult programmer in wikipedia In user interface widgets It is supposed to.. How to create the best singleton The smaller the better. I am a minimalist Make sure it is thread safe Make sure it is never..
What's the Right Way to use the rand() Function in C++? http://stackoverflow.com/questions/1117292/whats-the-right-way-to-use-the-rand-function-in-c computer clock or some other constantly changing number. Am I in over my head and should I stop now Is option 2 difficult..
Legality of COW std::string implementation in C++11 http://stackoverflow.com/questions/12199710/legality-of-cow-stdstring-implementation-in-c11 I found myself unable to directly support that statement. Am I correct that C 11 does not admit COW based implementations..
C++ Accesses an Array out of bounds gives no error, why? http://stackoverflow.com/questions/1239938/c-accesses-an-array-out-of-bounds-gives-no-error-why possible to do array 3 3 and array 4 4. I am using g 4.3.3 Am I missing something Here is compile and run command g W Wall..
Sorting a vector of custom objects http://stackoverflow.com/questions/1380463/sorting-a-vector-of-custom-objects as a key for sorting in the custom object should be used. Am I on the right track c stl sorting share improve this question..
C++: std::string in a multi-threaded program http://stackoverflow.com/questions/1661154/c-stdstring-in-a-multi-threaded-program doesn't guarantee that. So what say you stackoverflow Am I right that std string simply cannot be used reliably at all..
Reduce flicker with GDI+ and C++ http://stackoverflow.com/questions/197948/reduce-flicker-with-gdi-and-c Graphics grph pDC m_hDC grph.DrawImage bmp 0 0 Am I doing something wrong Or is there another way to achieve this..
Is it okay to inherit implementation from STL containers, rather than delegate? http://stackoverflow.com/questions/2034916/is-it-okay-to-inherit-implementation-from-stl-containers-rather-than-delegate a safer way I can implement this without so much typing Am I a heretic for using implementation inheritance Edit What about..
Floating point vs integer calculations on modern hardware http://stackoverflow.com/questions/2550281/floating-point-vs-integer-calculations-on-modern-hardware test of the relative speed Any ideas or thoughts Am I completely wrong The programs I used as follows they are not..
C++ - passing references to boost::shared_ptr http://stackoverflow.com/questions/327573/c-passing-references-to-boostshared-ptr and then decrement it when exiting the function scope. Am I overlooking something Andrea. EDIT Just to clarify after reading..
std::vector is so much slower than plain arrays? http://stackoverflow.com/questions/3664272/stdvector-is-so-much-slower-than-plain-arrays whole thing UseArray UseVector UseVectorPushBack return 0 Am I doing it wrong or something Or have I just busted this performance..
Undefined Behavior and Sequence Points Reloaded http://stackoverflow.com/questions/4638364/undefined-behavior-and-sequence-points-reloaded on the type of operands involved in the expression. Am I correct even partly By the way how about this expression Consider..
Post-increment and pre-increment within a 'for' loop produce same output http://stackoverflow.com/questions/4706199/post-increment-and-pre-increment-within-a-for-loop-produce-same-output 5 i printf d i I get the same output for both 'for' loops. Am I missing something c c order of evaluation share improve..
When to use forward declaration? http://stackoverflow.com/questions/553682/when-to-use-forward-declaration declaration of a class in another class's header file Am I allowed to do it for a base class for a class held as a member..
How can I redirect stdout to some visible display in a Windows Application? http://stackoverflow.com/questions/573724/how-can-i-redirect-stdout-to-some-visible-display-in-a-windows-application errorMessage 0 readStdin std string putReadStringHere 0 Am I just dreaming Or does anyone know of something that can do..
“using namespace” in c++ headers http://stackoverflow.com/questions/5849457/using-namespace-in-c-headers can be very deeply nested . So my question is double Am I right that using namespace should not be used in header files..
static vs extern “C”/“C++” http://stackoverflow.com/questions/592160/static-vs-extern-c-c is C. But I found out that using static works as well. Am I just lucky or... class X public static void proxy int i makecontext..
What's faster, iterating an STL vector with vector::iterator or with at()? http://stackoverflow.com/questions/776624/whats-faster-iterating-an-stl-vector-with-vectoriterator-or-with-at for vector string iterator it vs.begin it vs.end it it Am I faster 2. Using size_t index for size_t i 0 i vs.size i One.. size_t index for size_t i 0 i vs.size i One option vs.at i Am I faster Another option vs i Am I faster c performance stl.. i One option vs.at i Am I faster Another option vs i Am I faster c performance stl vector iterator share improve..
initializer_list and move semantics http://stackoverflow.com/questions/8193102/initializer-list-and-move-semantics and move semantics Am I allowed to move elements out of a std initializer_list T #include..
OpenCV won't compile due to unresolved externals — LNK2019 http://stackoverflow.com/questions/10472393/opencv-wont-compile-due-to-unresolved-externals-lnk2019 Debug Win32 1 Build started 5 6 2012 10 39 03 AM. 1 InitializeBuildStatus 1 Touching Debug openCVTest.unsuccessfulbuild..
How to compare two time stamp in format “Month Date hh:mm:ss” to check +ve or -ve value http://stackoverflow.com/questions/15555406/how-to-compare-two-time-stamp-in-format-month-date-hhmmss-to-check-ve-or-v tm Example to convert date time string Mar 21 11 51 20 AM into struct tm you need three formate strings b Month name can.. name or an abbreviation d Day of the month 1 1 . r Time in AM PM format of the locale. If not available in the locale time.. in the locale time format defaults to the POSIX time AM PM format I M S p. time_t mktime struct tm timeptr function..
How to explain undefined behavior to know-it-all newbies? http://stackoverflow.com/questions/2235457/how-to-explain-undefined-behavior-to-know-it-all-newbies that exist in the world exhibit to be on my desk by 10 AM tomorrow. Don't disappoint me now your future looks promising..
Linking Library In Visual Studio 2010 http://stackoverflow.com/questions/5487056/linking-library-in-visual-studio-2010 Debug Win32 1 Build started 3 30 2011 7 46 45 AM. 1 InitializeBuildStatus 1 Touching Debug simplVRML.unsuccessfulbuild.. error LNK2001 unresolved external symbol _arMatchingPCAMode 1 simpleVRML.obj error LNK2001 unresolved external symbol..
VS2010: project is not up to date “because ”AlwaysCreate“ was specified”? http://stackoverflow.com/questions/6054066/vs2010-project-is-not-up-to-date-because-alwayscreate-was-specified have the following output 1 Build started Project PROJ_NAME Configuration Release Win32 1 Build started 19 05 2011 7 59.. Release Win32 1 Build started 19 05 2011 7 59 27 AM. 1 InitializeBuildStatus 1 Creating Release PROJ_NAME.unsuccessfulbuild.. 59 27 AM. 1 InitializeBuildStatus 1 Creating Release PROJ_NAME.unsuccessfulbuild because AlwaysCreate was specified. 1 ClCompile..
|