Difference between revisions of "Cpp Coding Standards/OBSOLETE"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Topic-Id: '''OBSOLETE'''
+
== Obsolete Habits (OBSOLETE) ==
 +
''In the many years of developing OpenOffice.org and its antecessors some habits have been developed that once were needed, but now are obsolete. There are alternatives today to be preferred.''
  
In the many years of developing OpenOffice.org and its antecessors some habits have been developed that once were needed, but now are obsolete. There are alternatives today to be preferred.
+
===== Preferred Types <span id="Types">(Types)</span> =====
----
+
''Previously:'' “solar” types where used and various string implementations. For lists and vectors self-made types were implemented, often by macros.<br>
=== Summary ===
+
''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.<br>
==== Preferred Types <span id="Types">(Types)</span> ====
+
[[/Types|-> Details]]
'''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.
+
 
+
[[/Types|Details]]
+
 
+
==== Prefer Allocation from the Stack <span id="Stack">(Stack)</span> ====
+
'''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.
+
 
+
[[/Stack|Details]]
+
 
+
==== No Old Macros <span id="NoMacro">(NoMacro)</span> ====
+
'''Previously''': TRY and CATCH where used.
+
 
+
'''Now''': Use “try” and “catch”.
+
  
[[/NoMacro|Details]]
+
===== Prefer Allocation from the Stack <span id="Stack">(Stack)</span> =====
 +
''Previously:'' Heap allocation was preferred to stack allocation in function bodies, because stack size was small.<br>
 +
''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.<br>
 +
[[/Stack|-> Details]]
  
 +
===== No Old Macros <span id="NoMacro">(NoMacro)</span> =====
 +
''Previously:'' TRY and CATCH where used.<br>
 +
''Now:'' Use “try” and “catch”.<br>
 +
[[/NoMacro|-> Details]]
 
----
 
----
=== Related Rules ===
+
==== Related Rules ====
* [[../STL#Cont |STL:Cont]] -  Use the STL Containers
+
'''Prefer the STL Containers''' [[../STL#Cont|-> STL:Cont]]
  
 
----
 
----
 
[[Category:Coding Standards]]
 
[[Category:Coding Standards]]

Latest revision as of 09:28, 23 May 2007

Obsolete Habits (OBSOLETE)

In the many years of developing OpenOffice.org and its antecessors some habits have been developed that once were needed, but now are obsolete. There are alternatives today to be preferred.

Preferred Types (Types)

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.
-> Details

Prefer Allocation from the Stack (Stack)

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.
-> Details

No Old Macros (NoMacro)

Previously: TRY and CATCH where used.
Now: Use “try” and “catch”.
-> Details


Related Rules

Prefer the STL Containers -> STL:Cont


Personal tools