[mythtv] [PATCH] less crashes when no connection can be made to backend

Isaac Richards ijr at po.cwru.edu
Wed Oct 1 18:26:55 EDT 2003


On Wednesday 01 October 2003 04:54 pm, Tako Schotanus wrote:
> Ok, fixed (even some that weren't mine, including some "wrong" braces).
> NB: Look how "obvious" the convention is:
>      libs\libdvddev\dvbci.cpp - 59 tabs
>      libmyth\audiooutputalsa.cpp - 14 tabs
>      libmyth\mythplugin.cpp - 3 tabs
>      libmyth\mythwizard.cpp - 111 tabs
>      libmyth\oldsettings.cpp - 5 tabs
>      libmyth\minitzo.cpp - 842 tabs

Every single one of those files was written by someone other than myself.  
Generally, you copy the style of the file you're modifying.

> In my opinion you just don't write documentation for one function and
> not for the other just because "it's obvious".
> If everybody would write extensive, even obvious, comments in the code
> you'd be halfway towards having a API reference manual.

Obvious commenting gets in the way of the code.  // 

If you cared about an API reference manual, you'd use one of the standard 
tools for it, instead of coming up with your own function comment style like 
you have.

> If you look at the methods you are referring to you can see that they
> actually perform different functions depending on their arguments.
> With your suggestion I'd have to if-statements to distinquish between
> the cases, in my code the method overloading takes care of that.
> Both are perfectly normal options, I just happen to prefer method
> overloading over default values, that's all.

Doesn't seem that way to me -- 

QLabel *addLabel(QString caption);
QLabel *addLabel(QString caption, LabelSize size);

instead of:

QLabel *addLabel(QString caption, LabelSize = Medium);

No if statements required.  Same situation with ShowPopup().

Regardless, a very short if statement in a function is better than an entirely 
new function when they're doing the same thing.  If they're doing different 
things, they shouldn't be overloaded in the first place.  I prefer to leave 
function overloading to deal with different types.

New patch looks better, though, I'll see about getting it merged in later 
tonight.

Isaac


More information about the mythtv-dev mailing list