, 25 2021 . 21:44
+
applegame: :
static int foo(int m, int n) {
if (m == 0) return n + 1;
if (n == 0) return foo(m - 1, 1);
return foo(m - 1, n - 1);
}
int main() {
int n = 1;
*const_cast(&n) = foo(10, 12);
return n;
}
-O3
UB:
static int foo(int m, int n) {
if (m == 0) return n + 1;
if (n == 0) return foo(m - 1, 1);
return foo(m - 1, n - 1);
}
int main() {
const int n = 1;
*const_cast(&n) = foo(10, 12);
return n;
}
, , ( , ), :
, . UB - . ? 99.9999% , . , ?
Qraizer @ , , , . ?
- , UB- . , . . , .
UB, .
UB , . ?
https://forum.sources.ru/index.php?showtopic=421537&view=findpost&p=3848399
:
C/C++: