"Jonas Sundstrom" <kirilla@xxxxxxxxx> wrote: >About the Coding Guidelines.. > >The OpenTracker ones adopted by OBOS: >http://opentracker.sourceforge.net/guidelines.html > >Could someone explain the reasoning behind the >"f" prefix (for class member variables) ? > I'm not sure where the f comes from. While it is ok to use a f in OpenTracker, I just realized that we are creating a huge problem when using "f" or "m" prefix for class variables in our OS, because users have also variables in classes derived from OS classes. Some BeOSheader files already used "f" as a prefix, some use "m" "_m", "_m_", "m_", or perhaps others as well. This means, if some particular class was using _mBufferGroup as a private variable, some developer using this class was perhaps using fBufferGroup as a variable in a derived class. If we now change all our variable prefixes to "f", we may collide on compile time. This may happen to many classes, and many source code. I think we should use a identifyer prefix that is reserved for the implementor of libraries. http://homepages.tu-darmstadt.de/~st002279/os2/Standards.html http://www.lysator.liu.se/c/rat/d1.html (excerpt from the C89 standard draft) |4.1.2.1 Reserved identifiers | | Also reserved for the implementor are all external identifiers beginning with an underscore, | and all other identifiers beginning with an underscore followed by a capital letter or an | underscore. This gives a space of names for writing the numerous behind-the-scenes | non-external macros and functions a library needs to do its job properly. | With these exceptions, the Standard assures the programmer that all other identifiers are | available, with no fear of unexpected collisions when moving programs from one implementation | to another. I'm not sure which one is really save. Is a class variable an "external identifier"? Then we may be able to use "_f", "_m" or any other prefix that starts with an underscore. If it isn't, we may need to use "__f", "__m", or "_M", "_F", or anything else starting with either two underscores, or one underscore and a capital letter. I really think we need to be careful here. No Identifiers (this also includes global variables, as well as non static pricvate functions, or entire classes" used internally should have a normal name, but must start with "_" or must be put into a namespace, if possible. As media kit programmer, I know that the media kit also has many potential name collisions, but I will correct them as soon as we have a determined a standard for them. The OpenTracker "f" should not be our standard, as it collides with the C standard. We need to change the coding guidelines! Personally, I would prefer using "_f" or "_m", but I'm not sure if they are the right choice. regards Marcus