Skip to content

Instantly share code, notes, and snippets.

@lenary
Last active May 17, 2017 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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;
}
@wonsubkim
Copy link

Okay, I will refer this example code
Actually, I will insert additional test code for checkedc/typechecking/checked_scope.c using above example code
Thanks a lot

@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