Closed sergeken closed 7 years ago
Thank you. I fixed it in different manner, but your suggestion was just as good. It's just that I prefer to see what can throw in the future.
This is indeed an alternative approach and my first "version". However, I'm more in favor of late declaration and having variables with limited scope. I was even tempted to write
auto const content_length = stoull(it->second);
Which is very much favored by Herb Sutter and others and my "new" style.
In general, I agree with you. But it is a help for future me that might wonder why this try block is here. Especially when working with Asio and all its nuts and bolts:)
compiling server_http.hpp with g++ 7.1 gives the following error messages: ../../Prometheus/src/web_services/server_http.hpp:278:44: error: uninitialized variable ‘content_length’ in ‘constexpr’ function unsigned long long content_length; ^
~~~~~Changing the try-catch block as following fixes the issue.