Skip to content

Instantly share code, notes, and snippets.

@lenary
Last active May 17, 2017 07:15
Show Gist options
  • Save lenary/ed2759af551d50a99ba7b0451cb55912 to your computer and use it in GitHub Desktop.
Save lenary/ed2759af551d50a99ba7b0451cb55912 to your computer and use it in GitHub Desktop.
#include <stdio.h>
// The file with the unchecked interface
#include <stdlib.h>
// The Redeclaration with the correct type
void *calloc(size_t nmemb, size_t size) : byte_count(nmemb * size);
#pragma BOUNDS_CHECKED ON
int main(void) {
_Array_ptr<int> arr : count(4) = calloc(4, sizeof(int));
for (int i = 0; i < 4; i++)
_Unchecked {
printf("%d\n", arr[i]);
}
return 0;
}
@lenary
Copy link
Author

lenary commented May 17, 2017

I updated it with the right keyword names and including the stdio header. Oops. But you got the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment