pdf.css
Google


   


You are here: CodeIdol > C++ > C/C++ Programming Style Guidelines > page: 2 3 4 5 6 7 8 9 10 11 12


The formatting style presented here is essentially that used by Stroustrup in The C++
Programming Language
. If you use Emacs you can make this your default editing
mode by adding the following to your

.emacs
file:
(defun my-c-mode-common-hook ()
(c-set-style "stroustrup"))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
Format your code so that the spatial structure illustrates the logical structure. Use blank
lines to help separate different ideas, use indentation to show logical relationships, and
use spaces to separate functionality. Each block of code should do exactly one thing.

Start all function definitions and declarations in column zero. Put the return value type,
the function interface signature (name and argument list), and the function body open
bracket each on a separate line. For functions that are more than a few lines long, put
the function name after the closing bracket in a comment.

Example 3. Formatting function declarations and definitions
void
debug(const string& message);
int
Class::method(const int x, const string& str)
{
.
.
.
} // method
You are here: CodeIdol > C++ > C/C++ Programming Style Guidelines > page: 2 3 4 5 6 7 8 9 10 11 12


ADBRITE ads links
   
Related tags







Popular Categories
Unix books and guides

AJAX popular information
C# language guides
Windows books and cookbooks

.......








Business Key Top Sites

be number one
rate your site




    С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.

    Русский Polski Francais Deutsch
    support sitemap terms

© CodeIdol Labs, 2007 - 2009