Difference between revisions of "Cpp Coding Standards/IFC"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
m
Line 2: Line 2:
 
The public functions of a class are in interface, but these items refer also to any other kind of interface. They are especially important for classes or functions that are expected to be used by possibly yet unknown clients.
 
The public functions of a class are in interface, but these items refer also to any other kind of interface. They are especially important for classes or functions that are expected to be used by possibly yet unknown clients.
 
----
 
----
=== Rules ===
+
=== Summary ===
 
+
 
==== Consistency ====
 
==== Consistency ====
 
Give the same thing the same name everywhere in the interface.
 
Give the same thing the same name everywhere in the interface.
Line 20: Line 19:
 
=== Related Rules ===
 
=== Related Rules ===
 
* [[../CLSDESIGN#OneResponsibility | CLSDESIGN:OneResponsibility]]
 
* [[../CLSDESIGN#OneResponsibility | CLSDESIGN:OneResponsibility]]
 +
----
 +
=== Explanations ===
 +
 
----
 
----
 
[[Category:Coding Standards]]
 
[[Category:Coding Standards]]

Revision as of 18:17, 27 November 2006

Interfaces

The public functions of a class are in interface, but these items refer also to any other kind of interface. They are especially important for classes or functions that are expected to be used by possibly yet unknown clients.


Summary

Consistency

Give the same thing the same name everywhere in the interface.

Let parameters with the same semantic always occur in the same order in different functions.

Minimality

Provide only one way to do anything. Move functions that do not belong to the core functionality of the interface to more appropriate locations.

For classes: Put convenience functions as non-member functions in the same namespace beside the class.

UnambiguousOverloads

Let all overloads of a function be unambiguous. Be aware of default arguments and integral vs. pointer parameters. Provide either only one version of an integral type or (rarely) overloads for all C++ integer-types.


Related Rules


Explanations


Personal tools