make destructors virtual in base classes and only there.

   try to implement your class in a way that the automatically generated
   copy constructor and copy assignment work out-of-the box.

(we agreed on that a few weeks ago)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8167 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-12-01 13:53:25 +00:00
parent 4b2c271e23
commit 302f32d7fa
3 changed files with 63 additions and 22 deletions

View File

@ -1,3 +1,56 @@
2003-12-01 André Pönitz <poenitz@gmx.net>
* Code_rules/Recommendations:
* Code_rules/Rules:
+ try to implement your class in a way that the automatically generated
+ copy constructor and copy assignment work out-of-the box.
Index: Rules
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/development/Code_rules/Rules,v
retrieving revision 1.14
diff -u -p -r1.14 Rules
--- Rules 25 Sep 2002 14:26:09 -0000 1.14
+++ Rules 1 Dec 2003 13:48:53 -0000
@@ -247,20 +247,6 @@ Formatting
-NOT-
void mangle () // wrong
-* Use of braces
-
- We use braces a lot, even if this lowers the density of the code in
- some cases. In particular we use braces for one-liners in relation
- to if, while, etc.
-
- if (true) {
- do_that();
- }
- -NOT-
- if (true)
- do_that();
-
-
* Enumerators
enum {
one = 1,
@@ -293,12 +279,9 @@ Formatting
* Formatting
- - Please adapt the formatting of your code to the setting in LyX in that
- particular file. Lars and Asger are slowly, but surely moving the source
- towards Linux kernel style formatting, aka K&R style. We suggest that you
- also do this, but this is NOT something that has been decided generally.
- (a pity - jbl)
-
+ - Adapt the formatting of your code to the one used in the
+ other parts of LyX. In case there is different formatting for
+ the same construct, use the one used more often.
* Use existing structures
2003-11-05 João Luis M. Assirati <assirati@fma.if.usp.br>
* lyxsocket/lyxclient.man: a man page for lyxclient.

View File

@ -14,7 +14,7 @@ follow these rules, but they should be the goal.
operator for all classes with dynamically allocated memory that
do not inherit noncopyable
- make destructors virtual in base classes.
- make destructors virtual in base classes and only there.
- assign to all data members in operator=.
@ -59,8 +59,13 @@ Design. Addison-Wesley, 1992
==================================
And one of mine: (Lgb)
And one of mine: (Lgb)
- When swiching on enums, refrain from using "default:" if possible.
And one of mine: (Andre')
- try to implement your class in a way that the automatically generated
copy constructor and copy assignment work out-of-the box.

View File

@ -247,20 +247,6 @@ Formatting
-NOT-
void mangle () // wrong
* Use of braces
We use braces a lot, even if this lowers the density of the code in
some cases. In particular we use braces for one-liners in relation
to if, while, etc.
if (true) {
do_that();
}
-NOT-
if (true)
do_that();
* Enumerators
enum {
one = 1,
@ -293,12 +279,9 @@ Formatting
* Formatting
- Please adapt the formatting of your code to the setting in LyX in that
particular file. Lars and Asger are slowly, but surely moving the source
towards Linux kernel style formatting, aka K&R style. We suggest that you
also do this, but this is NOT something that has been decided generally.
(a pity - jbl)
- Adapt the formatting of your code to the one used in the
other parts of LyX. In case there is different formatting for
the same construct, use the one used more often.
* Use existing structures