sewardj | 3079260 | 2002-05-18 19:54:36 +0000 | [diff] [blame] | 1 | #include <stdlib.h> |
| 2 | #include <stdio.h> |
| 3 | |
| 4 | class Test { |
| 5 | public: |
| 6 | int a, b, c, d; |
| 7 | }; |
| 8 | |
rjwalsh | 3360680 | 2004-04-13 19:11:27 +0000 | [diff] [blame] | 9 | void *operator new[](size_t size) |
sewardj | 3079260 | 2002-05-18 19:54:36 +0000 | [diff] [blame] | 10 | { |
| 11 | void *ret = malloc(size); |
| 12 | printf("Here.\n"); |
| 13 | for (unsigned int i = 0; i < size; i++) ((char *) ret)[i] = 0xFF; |
| 14 | return ret; |
| 15 | } |
| 16 | |
| 17 | int main(int argc, char *argv[]) { |
| 18 | Test *toto; |
| 19 | int i; |
| 20 | int j = 0; |
| 21 | |
| 22 | toto = new Test[2]; |
| 23 | |
| 24 | for (i = 0; i < 2; i++) { |
| 25 | if (toto[i].a) { |
| 26 | j++; |
| 27 | } |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 28 | //printf("%d : %08x %08x %08x %08x\n", i, toto[i].a, toto[i].b, toto[i].c, toto[i].d); |
sewardj | 3079260 | 2002-05-18 19:54:36 +0000 | [diff] [blame] | 29 | } |
| 30 | } |