add malloc-new
This commit is contained in:
parent
7579fe1f6e
commit
4b953bf080
3 changed files with 17 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -23,3 +23,4 @@ return-type-deduction
|
||||||
division
|
division
|
||||||
poly
|
poly
|
||||||
ohai-const-strings
|
ohai-const-strings
|
||||||
|
malloc-new
|
||||||
|
|
|
@ -20,6 +20,7 @@ add_executable(bad_alloc bad_alloc.cpp)
|
||||||
add_executable(rtti rtti.cpp)
|
add_executable(rtti rtti.cpp)
|
||||||
add_executable(poly poly.cpp)
|
add_executable(poly poly.cpp)
|
||||||
add_executable(division division.cpp)
|
add_executable(division division.cpp)
|
||||||
|
add_executable(malloc-new malloc-new.cpp)
|
||||||
add_executable(ohai-const-strings ohai-const-strings.cpp)
|
add_executable(ohai-const-strings ohai-const-strings.cpp)
|
||||||
|
|
||||||
add_executable(future future.cpp)
|
add_executable(future future.cpp)
|
||||||
|
|
15
malloc-new.cpp
Normal file
15
malloc-new.cpp
Normal 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);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue