Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As far as I know, even things like:

uint16_t array[] = { 1, 2, 3, 4 }; cout << "Hello World " << 3[array] << endl;

are valid and well defined. Part of what makes memory access validation such a pain in the ass in C++ is that no attempts are really made at specifying rules for how you can come up with memory locations; just rules on which locations you can read and write from. You can do things like "((int)rand()) = 2", and nothing in the standard says this is an invalid thing to do, so long as you are lucky enough for rand() to point somewhere allocated.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: