#include <iostream> #include <cmath> #define max(x,y) (x)>(y)? (x): (y) int main() { int i = 10;
This code has an interesting bug: some_struct struct_array1[10] = {0}; some_struct struct_array2[10] = {0}
I know this has been asked thousands of times but I just can\'t find the error in my code. Could someone kindly point out what I\'m doing wrong?
Is there any problem with throwing an object constructed on the stack in a try-block by non-const reference, catching it and modifying it, then throwing it by reference to another catch block?
There\'a a handful of situations that the C++ standard attributes as undefined behavior. For example if I allocate with new[], then try to free with delete (not delete[]) that\'s undefined behavior -
I\'m working on a mysterious bug in the usually very good open source project Excel Data Reader. It\'s skipping values reading from my particular OpenXML .xlsx spreadsheet.
C++ standard says that modifying an object originally declared const is undefined behavior. But then how do constructors and destructors op开发者_运维知识库erate?
In VC++7 if I do the following: void myTerminate() { cout << \"In myTerminate()\"; abort(); } int main( int, char** )
Consider the following code : void populate(int *arr) { for(int j=0;j<4;++j) arr[j]=0; } int main() { int array[2][2];
Turns out many inno开发者_JAVA百科cently looking things are undefined behavior in C++. For example, once a non-null pointer has been delete\'d even printing out that pointer value is undefined behavio