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

Re: Debian coding style?



On Fri, May 07, 1999 at 03:45:36PM -0400, Amy Fong wrote:

> 3. Tabs should be set to 2, and they should be kept as tabs, no spaces
> please.

What's the point in using a tab for just two spaces? It doesn't save that
many bytes, and makes it harder for every one to work on the code, as one
has to redefine the usual 8 spaces tab size on the editor.  
 
> c) Variable names must use hungarian notation (see below) followed by
> upper-case followed with mixed upper/lower case and must always take the
> form of a descriptive noun. Variables which are members of a class must have
> m_ prepended to the name.

I bet you won't find much code on our distribution that follows that
rule. :-) IMHO, it doesn't help that much.

> 14. Compilation conditionals, with the exception of debug code noted above,
> should be avoided since they make the source code difficult to read and
> maintain. 

They make it easier to write code that can be used on several platforms, 
as you can include or exclude some features at compile time depending on
the platform.

> 22. Localization: text which will be visible to the user should never be
> embedded within the source code. All string literals should be placed in a
> separate header file to ease the pain of possible future translation.

Been there, done that, switched to gettext as soon as I could.
Messages on a header file make it hard to read the code, hard to maintain
it, and one has to compile one version for each language. 
"message catalog" systems as gettext give code that is easy to read and
maintain, easy to translate (as the string literals are extracted
automatically from the sources to a single file for the translator), easy
to use (as one has just one executable for all languages, and will use
one language or another by defining an enviroment variable at run time),
and are the standard way for localization in Unix environments (in two
incarnations, X/Opens catgets and Uniforums gettext).

--
Enrique Zanardi					   ezanardi@ull.es


Reply to: