program to find out whether malloc() returns NULL on a failed call or not

Dependencies:   mbed

Committer:
hlipka
Date:
Sat Jan 01 22:38:54 2011 +0000
Revision:
1:602fea3e6f8b
Parent:
0:77b549539791
testing with classes derived from Base

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hlipka 1:602fea3e6f8b 1 #include <stdio.h>
hlipka 1:602fea3e6f8b 2 #include "mbed.h"
hlipka 1:602fea3e6f8b 3
hlipka 1:602fea3e6f8b 4 #define MALLOC_SIZE 0x2000
hlipka 1:602fea3e6f8b 5
hlipka 1:602fea3e6f8b 6 class C2: Base
hlipka 1:602fea3e6f8b 7 {
hlipka 1:602fea3e6f8b 8 public:
hlipka 1:602fea3e6f8b 9 C2(int a){_a=a;}
hlipka 1:602fea3e6f8b 10 private:
hlipka 1:602fea3e6f8b 11 int _a;
hlipka 1:602fea3e6f8b 12 };
hlipka 1:602fea3e6f8b 13
hlipka 1:602fea3e6f8b 14 C2 a(1);
hlipka 1:602fea3e6f8b 15 C2 b(2);
hlipka 1:602fea3e6f8b 16
hlipka 1:602fea3e6f8b 17 int main() {
hlipka 1:602fea3e6f8b 18 printf("doing test\n");
hlipka 1:602fea3e6f8b 19 malloc(MALLOC_SIZE);
hlipka 1:602fea3e6f8b 20 malloc(MALLOC_SIZE);
hlipka 1:602fea3e6f8b 21 malloc(MALLOC_SIZE);
hlipka 1:602fea3e6f8b 22 malloc(MALLOC_SIZE);
hlipka 1:602fea3e6f8b 23 printf("finished\n");
hlipka 1:602fea3e6f8b 24 }