-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
turn all form of pointer arithmetic to locadd
- Loading branch information
1 parent
a02f264
commit fbd6603
Showing
15 changed files
with
172 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,15 @@ | ||
#include <stdlib.h> | ||
|
||
|
||
// typedef struct { | ||
// int data; | ||
// int* next; | ||
// } node_t; | ||
typedef struct { | ||
void* lo; | ||
void* hi; | ||
} TData; | ||
int main(){ | ||
// node_t node; | ||
// node.data = 10; | ||
// node.next = malloc(sizeof(int)); | ||
// node_t* t = (node_t*)malloc(sizeof(node_t)); | ||
// t->data = 10; | ||
// int whatever; | ||
// int * data = malloc(sizeof(int)); | ||
// int * data2 = malloc(2*sizeof(int)); | ||
// free(data); | ||
// int i = *(data); | ||
int * data = malloc(sizeof(int)); | ||
int * data2 = malloc(2*sizeof(int)); | ||
free(data2); | ||
int i = *(data + 1); | ||
// int* j = NULL; | ||
// int* i = j; | ||
// // *(data + 1) = whatever; | ||
// int n = *(data+1); | ||
// if(i > 0) { | ||
// free(data); | ||
// } | ||
TData *p1 = malloc(sizeof(TData)); | ||
p1->lo = malloc(12); | ||
p1->hi = malloc(12); | ||
void *p2; | ||
int x; | ||
if(x) { | ||
p2 = p1->hi; | ||
} else { | ||
p2 = p1->lo; | ||
} | ||
free(p2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.