Попросил дать Hello World на C++, дало:
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
Спросил что можно улучшить в коде, еще раз спросил и т.д. Повторил несколько раз. В итоге получил:
#include <iostream>
#include <string_view>
namespace
{
// _lit1 is the first (and only) string literal
constexpr std::string_view _lit1{ "Hello, World!" };
}
// Prints the given message
[[nodiscard]] inline bool printGreeting674321(std::string_view message)
{
std::cout << message << '\n';
return std::cout.good();
}
int main()
{
std::ios::sync_with_stdio(false);
if (!printGreeting674321(_lit1))
return 1;
}
Стало ли лучше?