undefined-behavior
Does the following code invoke Undefined Behavior?
#include <iostream> #include <cmath> #define max(x,y) (x)>(y)? (x): (y) int main() { int i = 10;[详细]
2022-12-21 21:47 分类:问答Order of assignment evaluation (Have I found my first compiler bug?)
This code has an interesting bug: some_struct struct_array1[10] = {0}; some_struct struct_array2[10] = {0}[详细]
2022-12-21 15:55 分类:问答Reversing a string in C
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?[详细]
2022-12-21 04:56 分类:问答Throwing non-const temporaries by reference
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?[详细]
2022-12-20 20:04 分类:问答How to explain undefined behavior to know-it-all newbies?
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 -[详细]
2022-12-20 04:57 分类:问答Correcting XmlReader problems using ReadToDescendant and/or ReadElementContentAsObject
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.[详细]
2022-12-20 02:57 分类:问答If changing a const object is undefined behavior then how do constructors and destructors operate with write access?
C++ standard says that modifying an object originally declared const is undefined behavior. But then how do constructors and destructors op开发者_运维知识库erate?[详细]
2022-12-20 02:10 分类:问答Is null terminate() handler allowed?
In VC++7 if I do the following: void myTerminate() { cout << \"In myTerminate()\"; abort(); } int main( int, char** )[详细]
2022-12-19 10:18 分类:问答Validity of the code
Consider the following code : void populate(int *arr) { for(int j=0;j<4;++j) arr[j]=0; } int main() { int array[2][2];[详细]
2022-12-15 19:17 分类:问答Are memory leaks "undefined behavior" class problem in C++?
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[详细]
2022-12-15 05:55 分类:问答