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

Re: Miscellanous stuff



On Wed, 14 Jul 1999, Christian Reiniger wrote:

>> Bjarke Hammersholt Roune schrieb:

>Hungarian notation: IMHO if your code benefits from this, then you have
>a real problem. The type of a variable should be obvious from its
>context, and it should never live so long that you lose the point of
>declaration out of sight. And it makes coding really cumbersome and core
>really look ugly.

I prefer Hungarian for some parts of my _members_. I use it only for
members in classes, as these have a kind of global scope within a class.
Normally GUI widgets all get prefixed by 'btn', 'xpm', 'lb' etc (button,
pixmap, and listbox). I also _always_ prefix members with a 'm_'. So a
listbox would be like 'm_lbServers' for a listbox with some kind of
servers. Using 'm_' makes it easy to do methods that set some member,
like:

  Foo::setBar (int Bar) {
      m_Bar = Bar;
  }

You don't have to rename the parameter to 'NewBar' or similar, and you
always recognize your members and don't mix them up with local variables.

---------------------+------------------------------------------------------
 Jan 'Chakie' Ekholm |    CS at Åbo Akademi University, Turku, Finland
    Linux Inside     | I'm the blue screen of death, no-one hears you scream