add malloc-new

This commit is contained in:
neingeist 2014-08-24 14:59:54 +02:00
parent 7579fe1f6e
commit 4b953bf080
3 changed files with 17 additions and 0 deletions

1
.gitignore vendored
View file

@ -23,3 +23,4 @@ return-type-deduction
division
poly
ohai-const-strings
malloc-new

View file

@ -20,6 +20,7 @@ add_executable(bad_alloc bad_alloc.cpp)
add_executable(rtti rtti.cpp)
add_executable(poly poly.cpp)
add_executable(division division.cpp)
add_executable(malloc-new malloc-new.cpp)
add_executable(ohai-const-strings ohai-const-strings.cpp)
add_executable(future future.cpp)

15
malloc-new.cpp Normal file
View file

@ -0,0 +1,15 @@
#include <cassert>
#include <iostream>
using std::cout;
using std::endl;
int main(void) {
char** foo = new char*[100];
delete[] foo;
char** bar = (char**) malloc(100*sizeof(char*));
assert(bar != NULL);
// for valgrind to find:
// free(bar);
}