I'm a bit late but I think that you're effectively doing
int i;
(&i)[i];
Which is UB because you're accessing a random offset from i's location. It probably gets optimized away both because it's UB and because the value isn't used.
You never understand C++ completely. No matter what you do, Bjarne Strousup always tells you a feature that you didn't know about. Did you know that you could use structs as the counter variable in for loops? ```
The condition and the increment statement. The condition should be while variable.start < variable.finish and the increment statement should be variable.start += variable.step
Edit : Also, just noticed, while defining structs, as far as I remember the name comes after the definition so
121
u/MitchellMarquez42 Dec 02 '22
Oh no...
103
u/hugogrant Dec 02 '22
[]<>(){ std::cout<< "o rly";}();
53
u/wqldi Dec 03 '22
Maybe you understand somethings but no one understands c++ completely
92
u/Faces-kun Dec 03 '22
lmao I got a degree based on it and still don’t understand it
I now use HolyC instead. No understanding needed, only faith.
15
u/Diapolo10 Dec 03 '22
New Game! really is great
14
u/-Redstoneboi- Dec 03 '22
it's like quantum mechanics.
if you think you understand it, you don't.
17
u/masagrator Dec 03 '22
No, you don't.
8
u/HerrEisen Dec 03 '22
Finally! I know that I know nothing.
7
u/KillerRoomba13 Dec 03 '22
I think I understand it, but I still screw up pointers
2
u/ChocolateMagnateUA Jan 08 '23
You never understand C++ completely. No matter what you do, Bjarne Strousup always tells you a feature that you didn't know about. Did you know that you could use structs as the counter variable in for loops?
```
struct Counter {
int start, step, finish;
}
for (struct Counter variable = {0, 1, 100}; variable.start < stop; variable.step++) {}
```
2
u/you_do_realize Mar 16 '23
Cherish the moment, because it won't last long.
1
u/[deleted] Dec 03 '22
Suika (Alternate Universe) learns programming