Difference between revisions of "Talk:Writer/Code Conventions"

From Apache OpenOffice Wiki
Jump to: navigation, search
(anonymnous namespace)
Line 19: Line 19:
  
 
thb: they are far from useless, but they usually don't do the same as static linkage (namely, they are still external for the linker)
 
thb: they are far from useless, but they usually don't do the same as static linkage (namely, they are still external for the linker)
 +
 +
= virtual inheritance =
 +
 +
thb: does [http://www.ddj.com/cpp/184402074 this] capture the intention?

Revision as of 23:40, 22 October 2008

is/has-convention

bjm: Using the is/has convention for booleans allows writing code that reads like natural english:

if(m_isFileOpen && m_aSource.hasData() && their_isLoggingEnabled) lcl_writeLogEntry();

"If my file is open and my source has data and the logging for all SomeClass is enabled then write a log entry." an alternative would be our_ as prefix for static members.

if(m_isFileOpen && m_aSource.hasData() && our_isLoggingEnabled) lcl_writeLogEntry();

"If my file is open and my source has data and our logging is enabled then write a log entry."

hungarian prefixes

tl: Use the "a" prefix for class/struct values (not primitives like int, float, char, bool, ...) only.

bjm: Why not for primitives? Keep in mind there are still the optional prefixes.

For primitives (aka POD types) there are n for unsigned/int/long, f for double (hopefully float is not used ...), c for char and b for bool. Using a with those is just confusing and should be reserved for class object instances and similar. --erAck 14:28, 9 October 2008 (CEST)

anonymnous namespace

mst: imho anonymous namespaces in c++ are completely useless; just use static linkage instead

bjm: why not both? That might at least help code analysis tools like lxr, autodoc, doxygen etc.

thb: they are far from useless, but they usually don't do the same as static linkage (namely, they are still external for the linker)

virtual inheritance

thb: does this capture the intention?

Personal tools