Re: Verify and expression
Alf P. Steinbach wrote:
* Dave Harris:
char *s = VERIFY( strdup( "test" ), "out of memory" );
which would be more useful.
Featurism! ;-)
Well, a broadening of scope, because now it's very unclear what the
requirements are.
Anyway, the above is very possible, but I'd prefer
char const* s = strdup( "test" );
!!s || TERMINATE( "out of memory" );
I think it's important to save vertical space, which is always at a
premium.
(You mention also using a global variable to store the condition's value,
but I think that suffers from not being re-entrant or thread-safe. If you
had something else in mind, I missed it.)
Irrelevant! ;-)
Note that
std::cout << "uh, well" << std::endl;
is not thread safe.
In short, the argument seems to be, "because C++ does not currently
support threading, nothing can be implemented in C++ (it would not be
thread safe)", which smacks of fallacy, at least to my tongue's taste
buds.
I think the problem is cut clearer in this case: global shared state
invites a host of problems, among which threading problems. It's not a
fallacy.
Andrei
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]