Commit e87a0976 authored by Christian Godenschwager's avatar Christian Godenschwager
Browse files

initial commit

parents
a.out
\ No newline at end of file
cmake_minimum_required(VERSION 3.1)
project(CMakeTest)
set(CMAKE_CXX_STANDARD 14) # Tell the compiler to use C++14
set(CMAKE_CXX_STANDARD_REQUIRED ON) # The compiler must support C++14
set(CMAKE_CXX_EXTENSIONS OFF) # Disable compiler specific extensions
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic" )
option( SANITIZE_ADDRESS "Enable address sanitizer" OFF )
if( SANITIZE_ADDRESS )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address" )
endif()
add_executable(hello_world HelloWorld.cpp)
add_executable(sanitizer Sanitizer.cpp)
\ No newline at end of file
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
#include <iostream>
class HeapInt
{
public:
HeapInt( const int i ) : pi_( new int(i) ) {}
int get() const { return *pi_; }
private:
int * pi_;
};
int main()
{
HeapInt i( 42 );
std::cout << i.get() << "\n";
}
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
}
#include <iostream>
class HeapInt
{
public:
HeapInt( const int i ) : pi_( new int(42) ) {}
~HeapInt() { delete pi_; }
int get() const { return *pi_; }
private:
int * pi_;
};
int main()
{
HeapInt i( 42 );
std::cout << i.get() << "\n";
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment