Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated for VS 2013

...

Code Block
bgColor#FFCCCC
langc
#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;
}

When compiled with Microsoft Visual Studio (a C90-only platform) 2013 for a 64-bit platform, this noncompliant code example will eventually cause an access violation when dereferencing ptr in the loop.

...