undefined-behavior
Code crashes when derived class' destructor is virtual and base class' dtor is not
I tried the following code on gcc 4.4.5. If the member \'data\' is not present, the code executes fine, but in its presence, it crashes. It also doesn\'t crash when the derived class\' dtor is not vi[详细]
2023-03-09 06:15 分类:问答Standard reference for int foo = foo
int 开发者_如何学JAVAfoo = foo; compiles. Which part of the C++ standard allows this? 3.3.1 Point of declaration[basic.scope.pdecl][详细]
2023-03-09 06:06 分类:问答Is this example causing an undefined behaviour? [duplicate]
This question already has answers here: Closed 11 years ago. Possible Duplicate: Undefined Behavior and Sequence Points[详细]
2023-03-08 07:02 分类:问答C/C++: Is this undefined behavior? (2D arrays)
Is it undefined开发者_如何学Python behavior if I go through the elements of a 2D array in the following manner?[详细]
2023-03-06 16:32 分类:问答Advice on solving UD in low level management functions
I\'m fairly new to C and have started out writing a small library with functionality to get length of strings, reversing strings, converting binary data in char buffers to ints and shorts. Just for th[详细]
2023-03-06 02:24 分类:问答Does this C code produce "undefined behavior"?
I\'m reading an int开发者_JS百科eresting article A Guide to Undefined Behavior in C and C++, Part 1 on undefined behavior in C and C++. Often I do the following in my code:[详细]
2023-03-05 15:48 分类:问答Parameter evaluation and undefined behavior
Given this example (which is a simplication of an example in the documentation for boost::multi_index_container about update rollbacks):[详细]
2023-03-03 02:17 分类:问答Does this run into undefined behavior regarding object lifetimes?
#include \"stdio.h\" class C { public: ~C() { printf(\"~C\\n\"); } }; int I(const C& c) { printf(\"I\\n\"); return 0; }[详细]
2023-02-28 04:04 分类:问答Why different behavior for "TYPE* const" pointers?
Below code is dealing with a TYPE* const 开发者_如何学运维pointer. struct D { void Check () { D* const p = new D; // 2nd test is \"p = 0;\"[详细]
2023-02-25 16:08 分类:问答An union with a const and a nonconst member?
This appears to be undefined behavior union A { int const x; float y; }; A a = { 0 }; a.y = 1; The spec says[详细]
2023-02-25 13:06 分类:问答