Re: PeerInfo and PeerId

Hi Petr,

and what about:

switch()
{
...
// no default: so that we get a compile time warning
}
Q_ASSERT (false && "Unhandled Event value"); // so that we get a meaningful assert warning during debugging
return "unknown"; // so that we still return something even in release builds

I think initializing these variables in the ctor would be more work then just declaring static variables. Maybe if we always use only static class members of the same class there will not be any problems - I’ll give that a try!

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Re: PeerInfo and PeerId
Hi Peter, We could have the compiler help us in case a new Event is ever added to TrackerReqeust::Event. If TrackerRequestWriter::eventToString() uses a simple switch like that: [snip] the compiler will produce a (more...)

Follow-ups:
Re: PeerInfo and PeerId
Hi Peter, and what about: switch() { [snip] Yes, that sounds reasonably! However, I’ll try to compile and run `./tester` on our student servers that our faculty provides. There are various OS/compilers, so this way we (more...)