undefined-behavior
Not getting a segmentation fault when expecting it
I\'m toying with buffer overflows, but I\'m confused by what I\'m finding when running the following simple C program on Mac OS.[详细]
2023-03-18 05:35 分类:问答The value of out-of-bounds element of an array - should it change on each execution or stay the same?
For the actual question, jump to question part. For an interesting real-world example of undefined behavior, keep reading :)[详细]
2023-03-17 22:57 分类:问答NaN handled differently in different g++ versions
Consider the following program, which is obviously buggy: #include <cstdio> double test(int n) { if (n % 2 == 0)[详细]
2023-03-17 21:49 分类:问答How many parameters can I pass by reference in C++, without getting abnormal behavior
I had a problem with a function: int parsearRestricciones(char linea[], unsigned int& x, unsigned int& y, unsigned int& tiempo, char restric[])[详细]
2023-03-17 10:09 分类:问答What does the C++ standard say about stack overflow?
I took a look at the draft C++0x standard, and as far as I can tell there is nothing about stack overflow in there. Searching for \"stack overflow\" yields no results, and searching for \"stack\" I\'v[详细]
2023-03-17 07:01 分类:问答Is it well defined to declare an object of the class before its static variable in global space?
Following is a simple case of counting objects: struct A { static int count; A () { ++ count; } }; Now, its object and static member are 开发者_如何学Pythondeclared as:[详细]
2023-03-16 06:21 分类:问答Bug in quicksort example (K&R C book)?
This quicksort is supposed to sort \"v[left]...v[right] into increasing order\"; copied (without comments) from The C Programming Language by K&R (Second Edition):[详细]
2023-03-15 07:54 分类:问答C static inline function redefinition rules
Suppose in bar.h there might exist: static inline int fun () { return 2; } And to ensure that fun is always defined foo.h contains the following:[详细]
2023-03-15 00:02 分类:问答Is enum addition defined in ANSI C?
Is it a guarantee that state after this code will be LX_DONE开发者_如何学Go? enum lx_state { LX_START, LX_MIDDLE, LX_DONE };[详细]
2023-03-12 17:27 分类:问答Is it undefined behaviour to delete a null void* pointer?
I know that deleteing a null pointer is a no-op: In either alternative, if the value of the operand of delete is the null pointer the operation has no effect.[详细]
2023-03-09 17:01 分类:问答