[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sv: I'm back
>* What about "suspending" use of the parts' mailing list for now,
>moving all traffic to the main list? Having one creek is better than
>many trickles, especially in a restructuring phase as we are in now.
>Having everything on one list should make it harder to miss important
>pieces (some people might be only subscribed to one of the lists) and
>improve communication between the "parts" (not that it would be bad
>now, but each part's progress tends to be a bit too "non-public" IMHO).
>
I think that's a good idea.
>* I'm now doing a ppWarning ("Invalid Arguments"); when an API function
>in PFile is called with an invalid parameter and ppWarning ("Out of
>Memory"); when "new" fails. We should standardize on such messages so
>that the user can just grep over the debug output and get meaningful
>results. Ideas for more standard messages?
>
I propose an IMHO slightly more convinient way of doing things, that will
actually enforce the standards and make them easily changeable at a later
time:
#define PP_CHECK_ARG(EXP) \
if (!(EXP)) \
ppWarning("Invalid argument");
To see how this is a good idea, consider this code:
void ppSomeFunction(ppBlah* p1, ppBlah* p2)
{
#ifdef PP_DEBUG // (can't remember the correct symbol)
if (p1 == 0)
ppWarning("Invalid argument");
if (p2 == 0)
ppWarning("Invalid argument");
#endif
// ...
}
and then compare with this:
void ppSomeFunction(ppBlah* p1, ppBlah* p2)
{
PP_CHECK_ARG(p1 != 0);
PP_CHECK_ARG(p2 != 0);
// ...
}
I also think it would be a good idea to define this macro:
#define PP_ASSERT_ARG(EXP) \
if (!(EXP)) \
{ \
ppWarning("Invalid argument"); \
ppAssert(false); \
}
and these:
#define PP_WARN_NEW_FAIL \
ppWarning("Out of memory");
#define PP_WARN_INVALID_ARG \
ppWarning("Invalid argument"); // update the above macroes where this
message is used
Other errors messages could be "Unknown internal PenguinPlay error",
"Unknown internal PenguinSound error" etc. The meaning, of course, is that
something went wrong, but its hard to tell exactly what. "Invalid path",
"Non-existant file specified in path", "Invalid file-system specifier",
"Non-existant directory specified in path", "Object could not be
constructed" (ie, exception thrown from constructor), "Could not initialise
component", "Memory corrupted or bug".
I think these should all be defined as macroes of the kind PP_WARN_ + event.
Like so:
PP_WARN_INTERNAL_ERR
PP_WARN_INTERNAL_ERR_PSOUND
PP_WARN_INVALID_PATH
PP_WARN_INVALID_FILE
PP_WARN_INVALID_DIR
PP_WARN_INVALID_FS
PP_WARN_NO_CONSTRUCT
PP_WARN_NO_COMPONENT_INIT
PP_WARN_BAD_MEM
This will make it possible to get these kinds of warningmessages 100%
standardised, and will make it very easy to change them later.