I code in JAVA. Recently, in a CodeForces contest, I went on hacking a solution and discovered a C++ code that might face an array index out of bound error but it didn't. Later found out that there is no array index out of bound error in C++ and needs to be taken care of while coding. Due to this, my hack was unsuccessful. Basically my question is what things I need to take care of while hacking a C++ code if I code in other language? Do I need to start coding in other language? Most of the coders use C++ so I find it difficult to find a JAVA solution to hack.
LoOoOOoOLoOoOooOLoOooOoOooL. LMAO. ROFL. How do you even hack something that you dont understand? XD.
Because syntax is somewhat similar for both languages. Not that I'm totally unaware of what happens in C++. I just don't use it regularly that's why I was unfamiliar of the problem during hacking. Please think before commenting on any post and come up with a relevant answer.
Runtime checks slows program and design philosophy of C++ primarily focuses upon maximal speed. On the other hand language assumes that programmer knows and is aware of what he is doing.
If you want warnings for out of bound access then compiler flags can help.
When you do something wrong in C++ such as accessing elements out of the array bounds, you will mostly face undefined behavior and not a runtime error. So sometimes you can't easily hack these without having the code in your editor to check if it fails. And it might differ on Codeforces or other OJs, so run the code in that OJ if possible. Otherwise, it's mostly a gambling thing.
But typing the code back again would consume a lot of time. That's why I looking for similar things to take care of while hacking. Thanks anyways.
Just to mention that even the same code on the same OJ can behave differently when doing Undefined behaviour on multiple runs.