First I thought the compile time would take forever, or I take a weird error, but that didn't happen. The code runs for a while and then crashes.
This is my code:
#include <iostream>
inline void say_hello()
{
std::cout << "hello\n";
say_hello();
}
int main()
{
say_hello();
}
I thought the compiler will convert it to something like this:
#include <iostream>
int main()
{
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
std::cout << "hello\n";
// and crash because my storage is filled
}
But, I think the compiler ignored the inline keyword.