[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sv: Memory allocators



>I won't be able to do *any* coding until the weekend - likely even until
>after the weekend, so it's not urgent. Besides I first want to do the other
>changes (hashing code + URLs, then custom allocators) before. Well, perhaps
>including the auto_ptr stuff *before* the custom allocators is better...
>
Perhaps it would be a good idea to find out exactly who does what. I'm
finished with the ppDelPtr class (documenting it now).

You are going to do the hashtable and the URLs? Anything else that needs
doing?

>I'd say just one namespace (PenguinPlay) for all internals. The API should
>be outside the namespace to make things simpler for the user and because
>some APIs (e.g. the PFile one) have to be accessible from plain C (which
>doesn't know about namespaces).
>
I disagree. As far as my understanding goes, the C API is distinct and in
different headers than the C++ API (if its not, I think that migth be worth
considering). This means that the C API can be put in the global namespace,
and the C++ API can be put in its own namespace.

If something needs to be in both the C++ and the C API, I suggest handling
it like the standard library does: define things in a C header, and then do
like this for the C++ header:

namespace pp
{
#include "TheCHeader.h"
}

C++ gets its namespace without polluting the C header.

If the client wants the C++ API in the global namespace, he can just do
"using namespace pp".

IMHO this is the optimal solution.