|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-03-25 23:37:00
Mateusz Loskot wrote:
> Hi,
>
> I noticed this as popular convention across Boost libraries (e.g. endian)
> to deal with test cases that may throw or leak exceptions:
>
> int cpp_main( int argc, char* argv[] )
...
> Is there any reason to prefer that one over this one?
>
> int main( int argc, char* argv[] )
...
cpp_main is not a convention. It's mostly useful when you already have a
common `main` provided by the test framework, whether inside the static test
framework library or in a header such as
https://github.com/boostorg/detail/blob/develop/include/boost/detail/lightweight_main.hpp
The current state of affairs in Endian is because it used to use
<boost/detail/lightweight_main.hpp> and I switched away from it to avoid
having to depend on Detail.
In a self-contained test, there is no need to use cpp_main. Just write
`main` the usual straightforward way.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk