undefined-behavior
Is the following undefined behaviour?
The following is an in-lined(defined inside header file) static member function. Is the literal string \"MyClass\" always guaranteed to be in static memory? If not, will this not be returning a pointe[详细]
2023-04-11 03:35 分类:问答Why does integer overflow on x86 with GCC cause an infinite loop?
The following code goes into an infinite loop on GCC: #include <iostream> using namespace std; int main(){[详细]
2023-04-11 02:54 分类:问答Will clearing an already empty vector lead to undefined behavior?
What happens if I clear a vector which was already cleared before? I tried it out in Visual Studio and it did not lead to any run-time errors. But I\'m hunting for a possible cause to an exception (b[详细]
2023-04-08 03:30 分类:问答Reference to a temporary variable - why doesn't compiler detect it?
I hope this is not a duplicate, I\'ve read a number of related questions but no one seemed to cover this case:[详细]
2023-04-06 06:40 分类:问答what standard says about static casting to temporary inheritor?
sometimes (quite rarely) I need to get protected members from existing variables like this: struct S { protected:[详细]
2023-04-06 05:30 分类:问答constexpr undefined behaviour
I\'ve been experimenting with constexpr. On my test compiler (g++ 4.6) this fails to compile with an error about out of bounds access. Is a compiler required to spot this at compile time?[详细]
2023-04-05 09:48 分类:问答Undefined behaviour of sub-expressions
Does this result in undefined behaviour because the order of evaluation will be unspecified? int i =开发者_Python百科 0, j = 0, k = 0;[详细]
2023-04-05 05:30 分类:问答May I treat a 2D array as a contiguous 1D array?
Consider the following code: int a[25][80]; a[0][1234] = 56; int* p = &a[0][0]; p[1234] = 56; Does th开发者_如何学Ce second line invoke undefined behavior? How about the fourth line?Both lines[详细]
2023-04-01 15:22 分类:问答A C++ implementation that detects undefined behavior?
A huge number of operations in C++ result in undefined behavior, where the spec is completely mute about what the program\'s behavior ought to be and allows for anything to happen.Because of this, the[详细]
2023-03-31 20:14 分类:问答Why would this access violation occur with the /Og and /GL flags, with pass-by-reference?
When (and only when) I compile my program with the /Og and /GL flag using the Windows Server 2003 DDK C++ compiler (it\'s fine on WDK 7.1 as well as Visual Studio 2010!), I get an access violation whe[详细]
2023-03-31 10:10 分类:问答