...
However, to conform with the current C Standard, you must explicitly prototype every function before invoking it. An implementation that conforms to the C Standard may or may not perform implicit function declarations. However, C does require the implementation to issue a diagnostic if it encounters an undeclared function being used.
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stddef.h>
/* #include <stdlib.h> is missing */
int main(void) {
for (size_t i = 0; i < 100; ++i) {
/* int malloc() assumed */
char *ptr = (char *)malloc(0x10000000);
*ptr = 'a';
}
return 0;
}
|
Implementation Details
When compiled with Microsoft Visual Studio 2013 for a 64-bit platform, this noncompliant code example will eventually cause an access violation when dereferencing ptr
in the loop.
...