#include <stdio.h>
#include <stdexcept>

bool somefunction()
{
	int i = 0;

	printf("Running %d time\n", ++i);

	if (i > 1)
	{
		throw std::runtime_error("This code should be unreachable");
	}
}

int main(int argc, char **argv)
{
	try
	{
		printf("Calling function\n");
		somefunction();
		printf("Successfully returned from function\n");
	}
	catch (const std::exception &e)
	{
		printf("Caught exception: %s\n", e.what());
	}

	return 0;
}
