From 424bddbd3ec2f59880ae03afc6f63f81c16bdde6 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Fri, 12 Sep 2008 23:57:51 -0400 Subject: [PATCH] Removed doc/CodingStyle.txt as it is now documented in html --- ChangeLog | 1 + doc/CodingStyle.txt | 107 ---------------------------------------------------- 2 files changed, 1 insertion(+), 107 deletions(-) delete mode 100644 doc/CodingStyle.txt diff --git a/ChangeLog b/ChangeLog index 1bb9fcef..0a9c1046 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,7 @@ Release: version 0.14 - 2008/09/?? release.sh top level script, when using git - removed CVS-style ID code from contrib/barry-unbind-storage.sh since it made it look like cdfrey wrote it + - removed doc/CodingStyle.txt as it is now documented in html 2008/08/29 - added device name and backup label support to the GUI It is now possible to name devices, instead of just diff --git a/doc/CodingStyle.txt b/doc/CodingStyle.txt deleted file mode 100644 index 16ad075e..00000000 --- a/doc/CodingStyle.txt +++ /dev/null @@ -1,107 +0,0 @@ -I use plain old vim for editing files. As such, tabs are standard 8 -spaces wide. When aligning the code, indents are always tabs. - - if( something ) { - // tab to indent - } - - -Sometimes I need spaces to align function call parameters: - -void ClassName::Function(int lots, - int of, - int parameters, - int that_need_spaces_and_tabs, - int to_align_perfectly) -{ - // tab again -} - - -I even use tabs to align the beginning parts of comments: - -/// -/// \file tab_to_filename.cc -/// Tab to the doxygen description -/// - - -I also use tabs to align things like simple #define numbers: - -#define ASDF_NAME 0x01 // tab between name and number -#define ASDF_BODY 0x02 // tab between number and comment - - -The main place where I *don't* use tabs is inside tables that have to -be aligned, especially where there's not enough space to fit things in -one line when using tabs. For example, in the record classes, those -FieldLink<> tables might use tabs for the initial indent, but *everything* -else is spaces, to keep things lined up, and compact: - -FieldLink TaskFieldLinks[] = { - { TSKFC_TITLE, "Summary", 0, 0, &Task::Summary, 0, 0 }, - { TSKFC_NOTES, "Notes", 0, 0, &Task::Notes, 0, 0 }, - { TSKFC_START_TIME, "Start Time", 0, 0, 0, 0, &Task::StartTime }, - { TSKFC_DUE_TIME, "Due Time", 0, 0, 0, 0, &Task::DueTime }, - { TSKFC_ALARM_TIME, "Alarm Time", 0, 0, 0, 0, &Task::AlarmTime }, - { TSKFC_CATEGORIES, "Categories", 0, 0, &Task::Categories, 0, 0 }, - { TSKFC_END, "End of List", 0, 0, 0, 0, 0 }, -}; - - -As for coding style, I keep opening braces on the statement line: - - for( ... ) { - } - - if( something ) { - } - else { - } - -Except for switches, because that's just wrong. :-) - - switch( something ) - { - case 1: - break; - case 2: - break; - default: - break; - } - -I put spaces inside the parentheses too. - -For reeeeeally long lines, I sometimes favour keeping it all on one line -and things wrap. This is flexible... whichever looks best. But also -remember that grep is broken by wrapped lines, so if you're writing -code that could conceivably be grepped later, decide whether breaking -the line is worth it. I usually try to keep error message strings on -one line, even if they are long, since it makes it easier to grep for -them when bug reports come in. - - // example error message.... - dout("Something bad happened and the programmer was unable to contain his excitement and wrote some really long error message that wrapped across multiple lines, and now he needs to keep it that way so he can grep for it when users report the error occurred"); - - -I think that covers it. You may see some funky for() statements sometimes, -due to size: - - for( FieldLink *b = TaskFieldLinks; - b->type != TSKFC_END; - b++ ) - { - } - -As long as it is clear to read, I'm generally ok. You'll notice the -fixation on tabs again in this example. I'm less fussy about that, -if it's clear to read. - -Sometimes spaces are used to align ostream output as well: - - os << "something" - << "something more" - << std::hex << some_number; - - -- 2.11.4.GIT