Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-11-15 05:13:56


Hi Johan, Johan Nilsson <r.johan.nilsson_at_[hidden]> wrote: > "Should" is a strong word, IMHO. "Should" based on the guidelines discussed in this thread: http://lists.boost.org/Archives/boost/2006/02/101041.php > I find the usage of error_code as a parameter to methods > pollutes the domain interfaces and make them more complex. I'd > probably prefer a TSS-based solution. I have a strong opinion that a TSS-based solution is error prone, since any function call can modify the TSS value as a side effect. I have seen the following sort of incorrect code many times: if (!SomeWindowsAPICall()) { printf( "Error (%u): %s\n", GetLastError(), SomeOtherFunction()); } You might not find out that it's giving you the wrong error value until an obscure failure occurs at a customer site, and by that time it's too late :) > That's a big if. If we had this facility, I could use it and > you could still not use it. You, as a user, don't need to pay > for what you don't need. (Also, you're missing out the > modifying wrappers for SetLastError, errno=). No, I see it as a bad thing to bless a TSS-based solution for error codes in C++ by putting it in a public interface, due to the error prone nature. It's not a "don't pay for what you don't use" issue for me. Cheers, Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk