Difference between revisions of "Cpp Coding Standards/OBSOLETE"
m (Cpp Coding Standards/Topics/OBSOLETE moved to Cpp Coding Standards/Obsolete Habits: Improve Cpp_Coding_Standards structure.) |
|||
Line 1: | Line 1: | ||
− | + | Topic-Id: '''OBSOLETE''' | |
− | In the many years of developing OpenOffice.org and its antecessors some habits have been developed that | + | |
+ | 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. | ||
---- | ---- | ||
=== Summary === | === Summary === | ||
− | ==== | + | ==== 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. | + | '''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. | + | '''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. | |
− | + | ||
− | Now: Use “try” and “catch”. | + | [[/Stack|Details]] |
+ | |||
+ | ==== No Old Macros <span id="NoMacro">(NoMacro)</span> ==== | ||
+ | '''Previously''': TRY and CATCH where used. | ||
+ | |||
+ | '''Now''': Use “try” and “catch”. | ||
+ | |||
+ | [[/NoMacro|Details]] | ||
---- | ---- | ||
=== Related Rules === | === Related Rules === | ||
− | * [[../STL# | + | * [[../STL#Cont |STL:Cont]] - Use the STL Containers |
− | - | + | |
− | + | ||
---- | ---- | ||
[[Category:Coding Standards]] | [[Category:Coding Standards]] |
Revision as of 22:39, 29 November 2006
Topic-Id: 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.
Contents
Summary
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.
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.
No Old Macros (NoMacro)
Previously: TRY and CATCH where used.
Now: Use “try” and “catch”.
Related Rules
- STL:Cont - Use the STL Containers