mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 20:37:22 +02:00
Add initial implementation of quick_exit
This commit is contained in:
31
include/boost/core/quick_exit.hpp
Normal file
31
include/boost/core/quick_exit.hpp
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
|
||||
#define BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// boost/core/quick_exit.hpp
|
||||
//
|
||||
// Copyright 2018 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
void quick_exit( int code )
|
||||
{
|
||||
std::quick_exit( code );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_CORE_QUICK_EXIT_HPP_INCLUDED
|
@ -127,5 +127,8 @@ run exchange_move_test.cpp ;
|
||||
run empty_value_test.cpp ;
|
||||
run empty_value_size_test.cpp ;
|
||||
|
||||
run quick_exit_test.cpp ;
|
||||
run-fail quick_exit_fail.cpp ;
|
||||
|
||||
use-project /boost/core/swap : ./swap ;
|
||||
build-project ./swap ;
|
||||
|
17
test/quick_exit_fail.cpp
Normal file
17
test/quick_exit_fail.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
// Test for quick_exit.hpp
|
||||
//
|
||||
// Copyright 2018 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#include <boost/core/quick_exit.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::quick_exit( 1 );
|
||||
return 0;
|
||||
}
|
17
test/quick_exit_test.cpp
Normal file
17
test/quick_exit_test.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
// Test for quick_exit.hpp
|
||||
//
|
||||
// Copyright 2018 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#include <boost/core/quick_exit.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::quick_exit( 0 );
|
||||
return 1;
|
||||
}
|
Reference in New Issue
Block a user