Difference between revisions of "Cpp Coding Standards/OBSOLETE"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
m
Line 2: Line 2:
 
In the many years of developing OpenOffice.org and its antecessors some habits have been developed that are now obsolete. There are better alternatives today that should always be preferred.
 
In the many years of developing OpenOffice.org and its antecessors some habits have been developed that are now obsolete. There are better alternatives today that should always be preferred.
 
----
 
----
=== Rules ===
+
=== Summary ===
 
+
 
==== PreferredTypes ====
 
==== PreferredTypes ====
 
Previously: “solar” types where used and various string implementations. For lists and vectors self-made types were implemented, often by macros.
 
Previously: “solar” types where used and various string implementations. For lists and vectors self-made types were implemented, often by macros.
Line 22: Line 21:
 
=== Related Rules ===
 
=== Related Rules ===
 
* [[../STL#UseContainers | STL:UseContainers]]
 
* [[../STL#UseContainers | STL:UseContainers]]
 +
----
 +
=== Explanations ===
 +
 
----
 
----
 
[[Category:Coding Standards]]
 
[[Category:Coding Standards]]

Revision as of 18:18, 27 November 2006

Obsolete Habits

In the many years of developing OpenOffice.org and its antecessors some habits have been developed that are now obsolete. There are better alternatives today that should always be preferred.


Summary

PreferredTypes

Previously: “solar” types where used and various string implementations. For lists and vectors self-made types were implemented, often by macros.

Now: Use sal-Types instead of “solar” types. Use rtl:O[U]String[Buffer] classes instead of any other string implementation. Use STL containers instead of DECLARE_LIST and other self-made containers.

AvoidHeapAlloc

Previously: Heap allocation was preferred to stack allocation in function bodies, because stack size was small.

Now: Don't fetch local data or objects from the heap, if they are not of user-defined size. Allocation from the stack is faster.

NoOldMacros

Previously: TRY and CATCH where used.

Now: Use “try” and “catch”.


Related Rules


Explanations


Personal tools