Re: Verify and expression
* Mark Van Peteghem:
Alf P. Steinbach schreef:
An actual C++ code version of that description is available at <url:
http://home.no.net/alfps/misc/verify.cpp>; compiles with MSVC and g++.
A very inventive solution. But the DECLARE_TYPEOF_TYPE seems a bit
cumbersome. If you link independent libraries in an application, you
can't be sure that there will be no number that was chosen twice.
An anonymous namespace allows declarations per compilation unit, a
systematic numbering scheme allows more, and a C++0x-ready compiler (or
one supporting g++-like typeof) allows just about anything.
However, the VERIFY signature & effect isn't my design: it had to
conform to Dave Harris' example and requirements.
If I were to do this kind of VERIFY supporting side-effects, I'd just
let the client code pass in the required type -- explicit code, not
implicit code. ;-)
And actually, now that you mention it the type-detecting version should
ideally have been implemented in terms of one with the type as argument.
Gaining the best of both worlds.
also have no idea how performant thread specific storage is, but I
guess it's faster than converting the value to a string every time.
Thread local storage is very fast. As I recall in Windows it uses one
indirection (off a processor register); after all, the processor must
know which thread it's executing. However, it can be limited in the
number of pointers that can be allocated. And it can be dangerous. As
an example, Visual C++ provides direct support (a language extension)
for thread local storage, but as I recall not compatible with explicitly
loaded DLLs (a DLL is the Windows variant of dynamic library).
 "__declspec( thread )"
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
Q: What is the most annoying thing on usenet and in e-mail?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]