4 ms·
Not in the general case. char x[4]; printf("%c", x[4]); That's pretty easy to detect.
by XMPPwocky 10y ago
Not in the general case.
char x[4];
printf("%c", x[4]);
That's pretty easy to detect.
- ithkuil 10y agohere you're talking about compile time bound check _elimination_, i.e. statically determine when you can remove a runtime bound check which would have been added by the compiler. I think e3b0c was talking about completely static bound checks.
- codys 10y agoNo. We can look at the example given above and clearly know/prove that the access is out of bounds. ie: a C compiler could emit a diagnostic (or decide it's undefined behavior and treat it as unreachable). There aren't any bounds checks above to eliminate.