28 Pages

C & C++ Programming Style Guidlines

Course: COMPUTER S 10, Spring 2010
School: Aberystwyth University
Rating:
 
 
 
 
 

Word Count: 5037

Document Preview

Programming C/C++ Style Guidelines Fred Richards Style guidelines and programming practices for C/C++ code for Dynamic Software Solutions. Use the checklist at the end of this document prior to submitting code for peer review. De gustibus non est disputandum. 1. Introduction This document contains the guidelines for writing C/C++ code for Dynamic Software Solutions. The point of a style guide is to greater...

Register Now

Unformatted Document Excerpt

Coursehero >> United Kingdom >> Aberystwyth University >> COMPUTER S 10

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Programming C/C++ Style Guidelines Fred Richards Style guidelines and programming practices for C/C++ code for Dynamic Software Solutions. Use the checklist at the end of this document prior to submitting code for peer review. De gustibus non est disputandum. 1. Introduction This document contains the guidelines for writing C/C++ code for Dynamic Software Solutions. The point of a style guide is to greater uniformity in the appearance of source code. The benet is enhanced readability and hence maintainability for the code. Wherever possible, we adopt stylistic conventions that have been proved to contribute positively to readability and/or maintainability. Before code can be considered for peer review the author must check that it adheres to these guidelines. This may be considered a prerequisite for the review process. A checklist is provided at the end of this document to aid in validating the source codes style. Where code fails to adhere to the conventions prescribed here may be considered a defect during the review process. If you have not already, please study Code Complete by Steve McConnell. This book provides a detailed discussion on all things related to building software systems. It also includes references to statistical studies on many of the stylistic elements that affect program maintainability. Another valuable source of solid programming practice tips is The Practice of Programming by Brian W. Kernighan and Rob Pike. Scott Meyers 1 C/C++ Style Guide books, Effective C++ and More Effective C++ should be considered required reading for any C++ programmer. And what person would be considered complete without having read The Elements of Style by Strunk and White? 2. File Contents Use les to group functionality. Each le should contain only one cohesive set of functions. Avoid duplicating functionality in separate les. If different les contain similar functions, consider generalizing the function sufciently and putting it into its own le so that both function groups can use the one source. For C++ code, put only one class or closely related set of classes in each le. Avoid strong coupling between functions and classes implemented in separate les. If two objects are so strongly coupled that one can only be used in conjunction with the other then they belong in the same le. Use header les (.h sufx) to declare public interfaces, use code les (.c, .cc or .cpp sufx) to dene implementations. Typically each cohesive set of functions you write in a single le will have one accompanying header/interface le pair. Code that uses your implementation will #include the header le. Be precise with #include statements. Explicitly include the .h les you require, and only where you require them. If, for example, your code calls a function dened externally, include that functions associated .h in your implementation le not in your codes associated .h le. You should only need to include other les in your .h le if your public function interface or data type denitions require the denitions contained therein. Avoid using header les to contain a set of #include directives simply for convenience. This nesting of #include constructs obscures le dependencies from the reader. It also creates a coupling between modules including the top-level header le. Unless the modules are cohesively coupled functionally, and each requires all the .h les included in the convenience header, it is preferable to instead include all the 2 C/C++ Style Guide individual .h les everywhere they are required. 2.1. Header (Interface) File Content Header les should contain the following items in the given order. 1. Copyright statement comment 2. Module abstract comment 3. Revision-string comment 4. Multiple inclusion #ifdef (a.k.a. "include guard") 5. Other preprocessor directives, #include and #define 6. C/C++ #ifdef 7. Data type denitions (classes and structures) 8. typedefs 9. Function declarations 10. C/C++ #endif 11. Multiple inclusion #endif Example 1. Standard (C) header le layout /* * Copyright (c) 1999 Fred C. Richards. * All rights reserved. * * Module for computing basic statistical measures on * an array of real values. * * $Id$ */ 3 C/C++ Style Guide #ifndef STATISTICS_H #define STATISTICS_H #include <math.h> #include <values.h> #define MAXCOMPLEX { MAXINT, MAXINT } #ifdef _cplusplus extern "C" { #endif struct complex { int r; /* real part */ int i; /* imaginary part */ }; typedef struct complex Complex; ... /* * Compute the average of a given set. * Input - array of real values, array length. * Output - average, 0 for empty array. */ float ave(float* v, unsigned long length); ... #ifdef _cplusplus } #endif #endif /* STATUS_H */ 4 C/C++ Style Guide 2.2. Code Files C and C++ code les follow a similar structure to the header les. These les should contain the following information in the given order. 1. Copyright statement comment 2. Module abstract comment 3. Preprocessor directives, #include and #define 4. Revision-string variable 5. Other module-specic variable denitions 6. Local function interface prototypes 7. Class/function denitions Unlike in the header le, the implementation-le revision string should be stored as a program variable rather than in a comment. This way ident will be able to identify the source version from the compiled object le. For C les use: static const char rcs_id[] __attribute__ ((unused)) = "$Id$"; The __attribute__ modier is a GNU C feature that keeps the compiler from complaining about the unused variable. This may be omitted for non-GNU projects. For C++ les, use the following form for the revision string: namespace { const char rcs_id[] = "$Id$"; } Precede each function or class method implementation with a form-feed character (Ctrl-L) so that when printed the function starts at the start of a new page. 5 C/C++ Style Guide Example 2. Standard (C++) implementation/code le // // // // // // // Copyright (c) 1999 Fred C. Richards. All rights reserved. Module for computing basic statistical measures on an array of real values. #include "Class.h" #include <string> namespace { const char rcs_id[] = "$Id$"; } // Utility for prompting user for input. string get_user_response(); ^L Class::Class(const int len) { private_array_ = new[len]; } Class::~Class() { delete private_array_; } ^L ... 6 C/C++ Style Guide 3. File Format 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 le: (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 denitions 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 denitions void debug(const string& message); int Class::method(const int x, const string& str) { . . . } // method 7 C/C++ Style Guide Use a single space to separate all operators from their operands. The exceptions to this rule are the ->, ., () and [] operators. Leave no space between these operators and their operands. When breaking operations across lines, put the operator at the end of the broken line rather than at the start of the continuation line. Use four spaces for each level of indentation. Avoid making lines longer than 80 characters. When breaking lines, use the natural logical breaks to determine where the newline goes. Indent the continuation line to illustrate its logical relationship to the rest of the code in the line. For functions, for example, this means aligning arguments with the opening parenthesis of the argument list. Example 4. Breaking statements across multiple lines new_shape = affine_transform(coords, translation, rotation); if ( ( (new_shape.x > (new_shape.x < ( (new_shape.y > (new_shape.y < { draw(new_shape); } left_border) && right_border) ) && bottom_border) && top_border) ) ) Use a pure-block, fully bracketed style for blocks of code. This means put brackets around all conditional code blocks, even one-line blocks, and put the opening bracket at the end of the line with the opening statement. The exception to this rule is for conditions that are broken across multiple lines. In this case put the open bracket on a line by itself aligned with the start of the opening statement (as shown above). Example 5. Fully bracketed, pure block style if (value < max) { if (value != 0) { func(value); } 8 C/C++ Style Guide } else { error("The value is too big."); } Although the brackets may seem tedious for one-line blocks, they greatly reduce the probability of errors being introduced when the block is expanded later in the codes life. 3.1. Unique to C++ Start public, protected, private, and friend labels in column zero of class declarations. Use explicit public labels for all struct public elds and use explicit private labels for all private class members. The members of a class should be declared in the following order. Declare all public data members and type denitions rst. Declare private or protected data members or type denitions used in function member initialization lists or inline implementations next. Declare all public member functions next, starting with the constructors and destructor. Declare all remaining private or protected data members and type denitions next. Declare all private or protected function members next. Declare all friends last. Put simple inline function denitions on the same line as their declaration. For inline functions spanning multiple lines, use a pure-block style with four-space indentation. In general, avoid putting complex function implementations .h les. Example 6. Class declaration format class Type : public Parent { private: int x_; int y_; public: Type(); Type(int x) : x_(x) { } ~Type(); 9 C/C++ Style Guide int get_x() const { return x_; } void set_x(const int new_x) { x_ = new_x; } ... void display() { ... } } 4. Choosing Meaningful Names 4.1. Variable Names The name formatting conventions described here are essentially the GNU coding standards. These are available online using info. Use lower case for all variable names. For multi-word names, use an underscore as the separator. Use all capitals for the names of constants (i.e. variables declared const and enumerated types). Use an underscore as a word separator. Choose variable names carefully. While studies show that the choice of variable names has a strong inuence on the time required to debug code, there are unfortunately no clear and xed rules for how to choose good names. Review Chapter 9 of Code Complete periodically. In the mean time, here are some general guidelines to follow: Be consistent! The most important thing is to establish a clear, easily recognizable pattern to your code so that others will be able to understand your implementation and intent as quickly and reliably as possible. Use similar names for similar data types, dissimilar names for dissimilar types. 10 C/C++ Style Guide Avoid names that are homophones: e.g., foo, fu, phoo, etc. Also, dont rely on capitalization to distinguish between variables. Use names that say what the variable represents rather than how it is used (i.e. use nouns for variable names); use terminology from the application domain and avoid computer jargon that reects programming details. Avoid generic names such as tmp, buf, reg. Avoid intentionally misspelled words such as lo or lite. In general, short names are acceptable for variables that serve a short-lived purpose or that have a common usage in C/C++ (e.g., index variables called i, j, k, etc.). Being concise can contribute to the readability of code. However, for variables that serve a unique and important purpose, or variables that persist over a signicant region of your code, use descriptive and complete names. Studies have shown that minimal debugging time correlates with average variable name lengths of 10-16 characters. 4.2. Function Names Use lower-case letters for public function names. Use an underscore as a word separator. For functions that return no values (i.e. return type void), use strong verbs that indicate the functions purpose. Typically you will want to include the object of the verb in the name. For example, void remove_dc_offset(short *signal, const unsigned long length); void set_output_gain(const float gain); Because functions tend to serve a more complex purpose than variables, longer names are more acceptable. 11 C/C++ Style Guide If a function returns a value it is sometimes better to use a name that indicates the meaning of the value returned. For instance, /* * Compute the DC offset of the given signal. */ float dc_offset(const short * const signal, const unsigned long length); /* * Poll the D/A and return the current gain setting. */ float gain(void); In general, be consistent and be informative. Choose names that make your code easy to read and understand. 4.3. Classes, Structures and Type Denitions The name formatting conventions described here are essentially those used by Stroustrup in his book on C++. Capitalize the rst letter of the name of each data type that you dene. This includes all struct, class, typedef and enum types. Use an underscore as a word separator, just as for C variables and function names. For class instance variables, start all names with lower-case letters. Again, use an underscore as a word separator. Apply the same rules to public and protected members, both variables and functions. Add a trailing underscore to private member names. 12 C/C++ Style Guide Example 7. Capitalization of user-dened types /* Straight C */ struct complex { int r; /* real */ int i; /* imaginary */ }; typedef struct complex Complex; // C++ interface example class Canvas { public: enum Pen_style { NONE = 0, PENCIL, BRUSH, BUCKET }; Canvas(); ~Canvas(); void set_pen_style(Pen_style p); ... private: int cached_x_; // to avoid recomputing coordinates int cached_y_; }; // C++ usage example Canvas sketch_pad; sketch_pad.set_pen_style(Canvas::BRUSH); 13 C/C++ Style Guide When working with C++ classes and objects be mindful of redundant name elements. Remember that class members are identied by their class instance name. Thus you do not have to repeat information about the class in the member elements names. Example 8. Poor variable names // Notice how redundant "stack" becomes. template <Type> class Stack { public: int stack_size; add_item_to_stack(Type item); ... }; Stack my_stack; my_stack.add_item_to_stack(4); int tmp = my_stack.stack_size; 5. Comments In general, well written code should document itself. Clear, concise variable and function names, consistent formatting and spatial structure, and clean syntactical structure all contribute to readable code. Occasionally, however, complex logic will benet from explicit description. Be careful not to use comments to compensate for poorly written code. If you nd that your code requires many comments or is often difcult to describe, perhaps you should be rewriting the code to make it simpler and clearer. 14 C/C++ Style Guide 5.1. Style For straight C code, use /* ... */ style comments. For C++ code, use // ... style comments. Adhering to these conventions, you can quickly estimate the number of lines of comments in your code with the following commands: % grep "^[ \t]*\* " % grep "^[ \t]*\/\/" Too few or too many comments is an indicator of code that is likely be to difcult to maintain. Avoid the use of end-line comments except for variable declarations and for marking #if/#endif statements. Make comments be the only thing on a line. For longer comments describing more complex logic, use a block style to offset them from the code better. Use block-style comments to describe functions. Use bold comments to delimit major sections of your code le. Preface all bold comments and block comments that introduce functions with a form-feed character so that they appear at the start of the printed page. The following example shows the various comment types in the C style. Example 9. C comment types ^L /* * ************************************************ * Bold comment. * ************************************************ */ /* * Block comment. */ /* Short (single-line) comment. */ 15 C/C++ Style Guide int i; /* end-line comment */ 5.2. Content End-line comments are acceptable for describing variable declarations. Use a comment to describe any variable whose purpose is not obvious from its name. Use comments to document your intent. Do not describe how your code works, that should be obvious from the implementation. Instead describe why your code does what it does. Avoid explaining especially tricky code in comments. Instead, rewrite the code to make it intrinsically more obvious. Use complete sentences with proper spelling and punctuation in all comments. Write your comments before and as you write your code, not after. If you start by writing comments you give yourself a low-level design for the implementation. When you are nished testing your code, go back and review all comments to make sure they are still accurate. Comment things that have wide impact. If a function makes assumptions about the condition of variable on input, document that. If a required speed optimization makes the code difcult to read, explain the need for the code in a comment. If your code uses or changes any global variables, comment that. Use bold comments to delimit major sections in your code le. You may, for instance, implement a number of private utility functions. Use a bold comment to mark the start of that code. Preface each function with a block comment describing the functions purpose, the meaning of any input variables, and the signicance of any return value(s). There is no need to include the function name since it immediately follows the comment. Example 10. Commenting functions and function groups ^L 16 C/C++ Style Guide /* * **************************************** * Statistics utilities used to * optimize performance on the fly. * **************************************** */ /* * Compute the standard deviation or "variance" * for a set. * * Input: v - set of values and set size. * len - size of input set. * Output: Dev = Expect (x - x_ave)^2 * 0 for the empty set */ static float std_dev(const float *v, const unsigned long len) { ... } Use an end-line comment to mark the end of particularly long blocks of code. This applies to functions and conditional code. Include the control condition that terminates control for if/else branches and for/while/do loops. Use an end-line comment also to identify which #if or #ifdef statement a particular #endif statement closes. Include the condition in the comment for blocks of code spanning more than a few lines. When using #else conditions, mark both the #else and the #endif statements with the negated condition (i.e. preface it with not). Example 11. Commenting long code blocks #ifdef DEBUG . . 17 C/C++ Style Guide . #else // not DEBUG void function() { if (position != END) . . . } // position != END . . . } // function() #endif // not DEBUG 6. Syntax and Language Issues The following sections outline some general practices of good defensive programming. Always assume that others will have to read and maintain your code, and try to assist them as you write. Also, assume that errors and defects are inevitable, and write so as to isolate them and limit their effect as quickly as possible. This latter practices is sometimes referred to as "re-walling" code. Be liberal in checking the validity of input arguments within functions, and always check values returned by functions you call. 18 C/C++ Style Guide 6.1. General Avoid putting multiple instructions on the same line. Each line should do exactly one thing. This is applies in particular to control statements for branch and loop structures. Consider the following: /* Bad practice! */ if (!eof && ((count = get_more()) > min_required) { ... } This should be rewritten so that the act of getting more data is separate from the task of checking that more data remains to be processed: /* Safer version */ if (!eof) { count = get_more(); if (count > min_required) { ... } } Avoid the use of side-effects. The following innocuous line may actually produce different depending on which compiler is used: a[i] = i++; /* a[0] or a[1] == 1 ? */ Again, each line should contain a single statement, and each statement should do exactly one thing. 19 C/C++ Style Guide Avoid type casts and never cast pointers to void*. One of the strengths of C++ is its strong typing and ability to support arbitrary user types. If you feel the need to cast data to other types in C++, perhaps you should be considering dening an inheritance relationship or using templates. Do not dene any types from pointers (e.g., typedef char* String). Avoid using preprocessor constants (i.e. #defines). Instead declare variables of the appropriate C/C++ type as const and use them. For related sets of integer constants, dene an enum. Both of these techniques let the compiler perform type checking where the preprocessor #defines would not. Limit variable scope as much as possible. In C++, use brackets to group functionality and temporary variables. Declare a variable just prior to using it and destroy it when you are nished with it. Use parentheses to group logic in branch and loop control structures. Most people are not intimately familiar with operator precedence, and parentheses can make logic operations much easier for people to parse and understand. Without the additional parentheses it is not obvious that the rst case below differs from the other three (which are equivalent) for only one of the eight combinations of the booleans x, y and z: Example 12. One of these things is not like the other (x || y && y || z) (x && y || z) ( (x && y) || z ) ( (x || z) && (y || z) ) 6.2. Structured Programming Keep the structure of your code as clear as possible. Do not call exit() from library functions. Instead return with an appropriate error condition. Call return only once 20 C/C++ Style Guide for each function longer than a few lines. Avoid using break and continue to escape loop and branch code. Consider instead adding or changing the exit conditions of the the control statement. Do not use goto. Prefer using if/else/else/... over the switch/case/case/... with non-trivial branch conditions. For both constructs use default conditions only to detect legitimate defaults, or to generate an error condition when there is no default behavior. Using a switch/case block with overlapping conditions only when the cases have identical code so that fall-through is obvious. Prefer using while() { ... } instead of do { ... } while();. It is easier for humans to parse the control structure if they know the exit condition upon entering the block of code. The do { ... } while(); form buries the exit criterion at the end of the loop. Avoid overly long control structures. If you nd loop or branch constructs spanning several printed pages or screens, consider rewriting the structure or creating a new function. At the very least place a comment at the end of the structure to indicate the exit conditions. Avoid deeply nested code. Humans have a hard time keeping track of more than three or four things at a time. Try to avoid code structure that requires more than three or four levels of indentation as a general rule. Again, consider creating a new function if you have too many embedded levels of logic in your code. Avoid the use of global variables. They make your code hard to support in a multi-threaded environment. If you do use global variables, understand how they affect the ability of your module to be reentrant. 6.3. Functions and Error Checking Do not use preprocessor function macros. There are too many possible problems associated with them and modern computer speeds and compiler optimizations obviate any benet they once may have had. Dene a function instead. Write function declarations/prototypes for all functions and put them either in the 21 C/C++ Style Guide module .h le for public functions or at the start of the .c le for private, internal functions. The function declaration list should read like a table of contents for your code. Make explicit all assumptions about the condition of input data to your routines. Use assertions to test for programming errors, use exceptions (C++) or return values (C) to report error conditions detected in normal use. Do not put any implementation logic in your assertions since often they will not remain in the deployed code (especially library functions). When a library function must report both a computed value and a distinct error value, pass the computed value through a variable and return the error value. Check the return values of all library function calls. This is especially important for functions providing access to system resources (e.g., malloc(), fopen(), etc.). Generate informative error messages. Write messages that are understandable to the user. Be complete and concise and avoid using computer jargon. Suggest possible causes of the error condition. 7. Conclusion The guidelines presented here should be followed when writing all new code. When working with someone elses code it is more important that you adhere to the conventions used there. Only if the coding style is ad hoc should you impose your own (or these) conventions. A checklist is included at the end of this document. It covers most of the items discussed. Apply the checklist to your code prior to submitting it for peer review. Any unaddressed issue is considered a coding defect during the review process. Obviously a style guide cannot dictate good programming practices. It can only ward off some of the more agrant problems. With luck, a good style guide can encourage better programming habits. To that end, all C++ programmers should read Effective C++, by Scott Meyers. It covers far more concerns and goes into far greater detail on C++ than is appropriate here. It is critical for C++ programmers to understand these 22 C/C++ Style Guide issues when writing new code. Appendix A. Review Checklist File contents. Do all les contain: a copyright statement? an abstract/synopsis comment? a revision string? Do all header les contain a multiple include #ifdef? Are all necessary #includes made explicitly (i.e. the code does not rely on nested #includes)? Are all public functions declared in the modules .h le? Do function declarations/prototypes exist for all functions? Does each code le contain exactly one cohesive set of classes or functions? Are functions from different les sufciently uncoupled from one another? File format. Do all function declarations and denitions begin in column zero? Are the return type, function name and open bracket each on a separate line, each beginning in column zero? Do functions longer than a typical screen/page have comments with their name at the close bracket? 23 C/C++ Style Guide Is four-space indentation used throughout? Are all control structures in a pure-block style and fully bracketed? Is there a single space surrounding all operators, except ., ->, [] and ()? Do the C++ keywords public, private, protected, and friend all start in column zero? Are C++ class internals declared in the proper order? 1. public data and types 2. private or protected data and types used in the class declaration 3. public member functions, starting with constructors and the destructor 4. other private or protected data members 5. other private or protected functions 6. friends Variable and function names. Are all C variable and function names lower case, with an underscore as a word separator? Are all C++ variable and function names lower case, with capitalization rather than an underscore indicating word boundaries? Do all private class member names end with an underscore? Do all programmer-dened types/classes start with a capital letter? Are all constants and enumerated types all capital letters? Are all variable names sufciently informative and meaningful given their scope? Do variable names match the problem domain? Are variable names nouns? 24 C/C++ Style Guide Are function names strong verbs (or nouns for functions whose sole purpose is to compute a value)? Comments. Are bold comments used to divide code into major sections? Are block comments used to mark signicant points? Are end-line comments used only for variable declarations and to mark long blocks of code? Does C++ code use // ... style comments (not /* ... */)? Do all comments contain complete sentences, with proper punctuation and spelling? Do comments describe intent rather than implementation details? Is all subtle code sufciently explained in comments? Do all but the simplest functions have comments describing what they do, what data they operate on and any impact they have on the rest of the application? Language usage. General Does each line of code do exactly one thing? Are all constants declared as const and not as #defines? Does the code avoid casting variables and return values to different data types? Are there no casts to void*? Are no typedefs made from pointers (e.g., typedef char* Str?) Are there no preprocessor macros dened? Are parentheses used to group items in all but the simplest logic constructs? Are all private class members explicitly declared such? Program structure 25 C/C++ Style Guide Does each function call return from only one place? Is exit() called only from within main(), and only once? Do nal else blocks of if/else branches and default blocks of switch/case branches handle default conditions or error conditions only? Do all overlapping switch/case conditions (i.e. fall-throughs) use identical code? Has the use of global variables been avoided? Do most control structures span no more than a page or two? Is the close bracket of all longer controls structures commented with the exit criteria for the block of code? Does nested conditional code go no more than three or four levels? Has the use of structure-breaking directives such as goto, continue and break been avoided? Functions and error-checking Are functions used always instead of preprocessor macros? Are all assumptions about the condition of input data tested explicitly with assert()? Will the code perform the same way if assertions are removed? Do library functions return error values or throw exceptions (C++) wherever possible? Are all function return values tested or exceptions caught? Are all error messages informative to a typical user? Are messages complete sentences, with proper punctuation and spelling? 26 C/C++ Style Guide References The C++ Programming Language, Bjarne Stroustrup, 0-201-88954-4, Addison-Wesley, 1997. Code Complete: A Practical Handbook of Software Construction, Code Complete, Steve McConnell, 1-55615-484-4, Microsoft Press, 1993. Effective C++: 50 Specic Ways to Improve Your Programs and Designs, Effective C++, Scott Meyers, 0-201-92488-9, Addison-Wesley, 1998. The Elements of Style, William Strunk, Jr. and E. B. White, 0-02-418200-1, MacMillan Publishing Co., Inc., 1979. More Effective C++: 35 New Ways to Improve Your Programs and Designs, More Effective C++, Scott Meyers, 0-201-63371-X, 1996, Addison-Wesley, 1998. The Practice of Programming, Brian W. Kernighan and Rob Pike, 0-201-61586-X, Addison-Wesley, 1999. 27
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Aberystwyth University - COMPUTER S - 10
ContentsProgramming Windows Games with Borland C+iTwo/NRS6Prog Win Games Borland C+ 30292-6angela 4-2-93 FM LP#6Programming Windows Games with Borland C+iiTwo/NRS6Prog Win Games Borland C+ 30292-6angela 4-2-93 FM LP#6ContentsProgramming Window
Aberystwyth University - LITERATURE - 10
IntroducereCu mii decani n urm omul nu era att de tiutor de cele ce se afl n jurul lui i de legile care conduc materia. Tria o via simpl n mijlocul naturii, muncind din greu pentru a-i agonisi cele necesare traiului. Dar tocmai prin faptul c era lipit de
Aberystwyth University - LITERATURE - 10
1001 cri de citit ntr-o via 11. O mie i una de nopi - Anonim 2. Povestea tietorului de bambus - Anonim 3. Povestea lui Genji - Murasaki Shikibu 4. Cronica celor trei regate - Luo Guanzhong 5. Marginea apei - Shi Nai'an &amp; Luo Guanzhong 6. Mgarul de aur -
Aberystwyth University - LITERATURE - 10
Aberystwyth University - LITERATURE - 10
Allen Carrn sfrit nefumtorAllen Carrn sfrit, nefumtorMetoda uoar a lui Allen Carr Ediia a treia Traducere din englez Oana VladHUMANITAS1Allen Carrn sfrit nefumtorAllen Carr, de profesie contabil, fumtor de pn la 100 de igri pe zi, a ncercat zadar
Aberystwyth University - LITERATURE - 10
2061: A treia odisee spaialArthur C. ClarkeI MUNTELE VRJIT 1. Anii ngheai Pentru un brbat de aptezeci de ani, eti ntr-o form fizic remarcabil, observ doctorul Glazunov, lundu-i ochii de pe radiografia computerizat. Nu i-a da mai mult de aizeci i cinci d
Aberystwyth University - LITERATURE - 10
www.cartiaz.ro Carti si articole online gratuite de la A la ZBAZELE ELECTROTEHNICIIINTRODUCERE Circuitele sunt prezente in foarte multe domenii tehnice: in sistemul electroenergetic, in calculatoare, in sistemele de telecomunicatii, in aparatura audio s
Aberystwyth University - LITERATURE - 10
54. Matei Noul TestamentSfnta Evanghelie dup Matei 28 Capitole : 1,071 VerseteCapitolul 11:1 Cartea neamului lui Iisus Hristos, fiul lui David, fiul lui Avraam. 1:2 Avraam a nscut pe Isaac; Isaac a nscut pe Iacov; Iacov a nscut pe Iuda i pe fraii lui;
Aberystwyth University - LITERATURE - 10
3001: Odiseea finalArthur C. ClarkePROLOG: PRIMII NSCUI Spunei-le Primii nscui. Dei nu erau umani nici pe departe, erau din carne i oase, iar atunci cnd au privit adncurile spaiului s-au simit copleii, curioi i singuri. Imediat ce le-a stat n putere, au
Aberystwyth University - LITERATURE - 10
2001OodiseespaialArthurC.ClarkeI Noaptepreistoric 1.Drumulctrenefiin Secetaduradezecemilioanedeani,iarepocaoprlelorgiganticesesfrisedemulttimp. AicilaEcuator,pecontinentulcarentrobunziaveasfiecunoscutsubnumeledeAfrica,lupta pentruexistenatinseseonouculm
Aberystwyth University - LITERATURE - 10
2010:AdouaodiseespaialArthurC.ClarkeCapitolul 1 NTLNIRENMIEZULLUCRURILOR Chiarinaceaster,folosindmetrul,caunitatedemsur,diametrultelescopuluiaveanutreisutede metri,ciomiedepicioare.Disculuria,aezatntremuni,eraacumaproapepejumtatenumbr,ntimpce soareletro
Aberystwyth University - LITERATURE - 10
REGULI DE COMPORTARE SI MASURI DE PROTECTIE IN CAZ DE DEZASTRE1. Notiuni generale de comportare si de protectie in caz de dezastreAdeseori activitatile sociale si economice ale unor grupari umane pot fi tulburate de efecte tragice ale unor fenomene natu
Aberystwyth University - COMMUNICAT - 10
4.3.1 Alocarea numerelor interioare. 58Cuprins4.3.2. TABEL DE RESTRICII ALE FUNCIONRII CENTRALEI AMEX 802. 64 4.4 PRECIZRI PRIVIND UTILIZAREA TELEFOANELORCONECTATE LA ECHIPAMENTUL AMEX . 654.5 REPREZENTRILE GRAFICE PENTRU SEMNALELE ACUSTICECAPITOLUL
Aberystwyth University - LITERATURE - 10
C OLEC IACOLEC IATehnoredactor Grafica Redactor DirectorADRIAN BUCUR VALERIU PANTILIMON IONU GURGU MUGUR VASILIUCoperta I Arsanaua mnstirii Zografu (detaliu) Ionu GurguEDITURA SCARA Asociaia Romn pentru Cultur i Ortodoxie C.P. 1 46, Bucureti telefon
Aberystwyth University - LITERATURE - 10
PREFAPragmatici, trebuie s fim pragmatici n privina controlului pe care l exercitm asupra echilibrului nostru ponderal, adic asupra greutii. De prea multe ori modul de viat este rspunztor pentru rotunjirea noastr progresiv dar sigur i, apoi, pentru obezi
Aberystwyth University - COMMUNICAT - 10
UNIVERSITATEA DIN CRAIOVAFacultatea de inginerie n electromecanic, mediu i informatic industrialEUGEN SUBIRELUDISPOZITIVE ELECTRONICE I CIRCUITE ANALOGICE2009DISPOZITIVE ELECTRONICE I CIRCUITE ANALOGICE - CURSPREFAMaterialul prezentat constituie o
Aberystwyth University - LITERATURE - 10
Alexandre Dumas CONTELE DE MONTE-CRISTO volumul 1 I MARSILIA SOSIREA n ziua de 24 februarie 1815, santinela de la Notre-Dame de la Garde semnal &quot;Faraonul&quot;, corabie cu trei catarge, care venea din Smirna, Triest i Neapole. Potrivit obiceiului, o barc porni
Aberystwyth University - LITERATURE - 10
Alexandre Dumas CONTELE DE MONTE-CRISTO volumul 2I NTLNIREA A doua zi, la deteptare, primul cuvnt a lui Albert a fost propunerea de a merge s fac o vizit contelui. i mai mulumise n ajun, dar nelegea c un serviciu ca acela pe care i-l fcuse merita dou mul
Aberystwyth University - LITERATURE - 10
Alexandre Dumas CONTELE DE MONTE-CRISTO volumul 3 I PROCESUL VERBAL Noirtier atepta, mbrcat n negru i instalat n jil. Cnd cele trei persoane la care se atepta intrar, el privi ua; valetul o nchise imediat. Ia seama, i opti Villefort Valentinei, care nu-i
Aberystwyth University - COMMUNICAT - 10
Internetul istorie deja?de George Alin PopescuUN CADOU OFERIT DEwww.wall-street.roGeorge Alin PopescuInternetul, istorie deja?Internetul istorie deja?Cuprins:CAPITOLUL I PRIMII PAI. 3 UN FERMOAR DE MODA NOUA. 3 POVESTEA INTERNETULUI, CAPITOL NEREC
Aberystwyth University - COMMUNICAT - 10
www.cartiaz.ro Carti si articole online gratuite de la A la Z Informaia ca noiune n telecomunicaii GHEORGHE CLITAN (traducere i adaptare dup Jrme Segal, Le Zro et le Un. Histoire de la notion scientifique d'information au 20 sicle, Paris, ditions Syllepse
Aberystwyth University - LITERATURE - 10
J.W. GoetheSUFERINELE TNRULUI WERTHERTraducerea: Alexandru Philippide Am adunat cu srguin toate cele aflate cu privire la povestea bietului Werther, i acum le atern aici, tiind c mi vei mulumi pentru asta. Nu putei s refuzai spiritului i caracterului su
Aberystwyth University - LITERATURE - 10
Sistemul Pmnt LunProf. univ. dr. Iuliana Arma1. Caractere generale Luna este singurul satelit natural al Terrei. Raza medie a orbitei lunare este de 384 402 km. La perigeu (punctul cel mai apropiat de Terra) atinge 363 300 km. La apogeu (punctul cel mai
Aberystwyth University - COMMUNICAT - 10
1. NOIUNI DE BAZ 1.1. Defini ii.Clasificarea ma inilor electrice Prin ma in electric se n elege, un ansamblu de nf ur ri plasate pe un sistem de miezuri feromagnetice, fixe sau mobile ntre ele, cuplate electric, magnetic, sau electric i magnetic. Prin int
Aberystwyth University - COMMUNICAT - 10
No iuni generale 3.1.3. nfurri de curent alternativy &quot; $ # !!% % &amp; ' ' ' Nc ' $ N c = 2mpq # nf urarea *+ ntreag % , !=/2 m( zona de dus) zon de ntors. &amp;!#2p Nc! !## ( N c , p)Nc = mt. /01# &quot;*2 ) ) &quot; ! *3#Nc = m Nc = 2m# #4503.1.3
Aberystwyth University - OTHERS - 10
Atlantic Electronic Journal of Mathematics Volume 1, Number 1, Summer 2006http:/aejm.ca http:/rema.capp. 14HOW DO MATHEMATICS AND POKER MIX?Brian AlspachDepartment of Mathematics and Statistics University of Regina Regina, SK S4S 082I am asked frequ
Aberystwyth University - LITERATURE - 10
CAPODOPERE ALE LITERATURII UNIVERSALEUachiarelli (1469-1527)^1 /HMiEDITURA^ ^ | Niccolo Machiavelli, o m politic, ^ ^ B scriitor i renascentist italian din ^ ^ B Florena. Secretar de stat al Consi- ^ ^ B 1 ni 1 iu seniorilor din Republica ^H Flore
Aberystwyth University - OTHERS - 10
PLANTELE, SURSE DE PRODUCIE PENTRU BIOCOMBUSTIBILPLANTELE, SURSE DE PRODUCIE PENTRU BIOCOMBUSTIBILProf. dr. Valeriu TABR, conf. dr. Georgeta POP, drd. Wagner LADISLAU, drd. Cosmin Gabriel TABR, drd. Ioana Maria MATEA, drd. Monica Daniela PRODANProblema
Aberystwyth University - LITERATURE - 10
PROIECTUL MONTAUK EXPERIMENTE N TIMPCUVNT NAINTEEste foarte posibil ca, dintre toate misterele i necunoscutele care au marcat istoria planetei i a existenei umane, PROIECTUL MONTAUK s reprezinte cea mai uluitoare i totodat cea mai ocultat aciune de anve
Aberystwyth University - OTHERS - 10
CAPITOLUL 10. RADIOACTIVITATEA10.1. Reeaua naional de supraveghere a radioactivitii mediului La nivelul anului 2007, Reeaua Naional de Supraveghere a Radioactivitii Mediului a cuprins un numr de 37 de staii din cadrul Ageniilor pentru Protecia Mediului,
Aberystwyth University - OTHERS - 10
Despre regiunile temporale i pozitionarea lor s relativ aPaula-Cristina Ttaru a Facultatea de Matematic i Informatic as a Universitatea din Bucureti s Ionut Tutu Facultatea de Matematic i Informatic as a Universitatea din Bucureti sRezumat Logicile temp
Aberystwyth University - LITERATURE - 10
Editura LiterNet.ro, 2007StriniiSimona CratelRedactor i editor format .pdf Acrobat Reader: Rzvan Penescu - rpenescu@liternet.ro Text 2007 Simona Cratel Coperta i ilustraii 2007 Mona Filip Toate drepturile rezervate. 2007 Editura LiterNet pentru versiun
Aberystwyth University - OTHERS - 10
www.cartiaz.ro Carti si articole online gratuite de la A la ZGalaxiileGalaxiile sunt o compozitie universala de stele, gaz si praf, avand o complexitate colosala (la fel ca si marimea lor). Ca o functie secundara galaxiile sunt niste faruri uriase cu aj
Aberystwyth University - LITERATURE - 10
www.cartiaz.ro Carti si articole online gratuite de la A la ZPuterea Gndului - Swami SivanandaCAPITOLUL 1FIZICA I FILOSOFIA PUTERII GNDULUIGndul ntrece lumina n vitez n timp ce lumina cltorete cu circa 300.000 de kilometri pe secund, gndurile ajung pr
University of Warsaw - ACTSC - 231
Fall 2005 ACTSC231 Final Exam #1. a) The number of fruit flies in a certain lab increase at the compound rate of 4% every 40 minutes. If there are 100,000 fruit flies at 1 pm today, what will be the increase in the number of flies between 7 am and 11 am t
École Normale Supérieure - MATH - Geo100
1-1 Complete the Exploration on page 3Patterns and ReasoningDraw your segments in the space provided below. A table is provided for you.5. Step 1 2 3 4 5 6 7 8 9 10 Number of new segments 1 2 4 Total number of segments 1 3 76.7. 8.Checking Key Conce
École Normale Supérieure - MATH - Geo100
Section 6.6 Properties of Isosceles TrianglesLegs of an isosceles triangle (p. 313)Base of an isosceles triangle (p. 313)Base angles of an isosceles triangle (p. 313)Vertex angle of an isosceles triangle (p. 313)Isosceles Triangle Theorem IConverse
École Normale Supérieure - MATH - Geo100
Section 6.5 Applying CongruencePerpendicular bisectors Recall that the perpendicular bisector of a segment is perpendicular to the segment at its _.Perpendicular Bisector Theorem If a point is on the perpendicular bisector of a segment, then the point i
École Normale Supérieure - MATH - Geo100
Section 6.4 Congruent Triangles: ASA, AAS, and HLProving triangles congruentIn addition to the SSS and SAS Postulates, here is another postulate and two theorems that can be used to prove two triangles congruent. Angle-Side-Angle (ASA) Postulate: If two
École Normale Supérieure - MATH - Geo100
6.2 Exploring CongruenceCongruent polygons (p. 285)-two polygons for which each part (angle or side) of one is congruent to the corresponding part of the other.Corresponding part (p. 285)-an angle or side of one polygon that is in the same position as a
École Normale Supérieure - MATH - Geo100
6.1 Triangle InequalitiesSide lengths of a triangle Triangle Inequality Theorem 1The sum of the lengths of any two sides of a triangle is greater than the length of the third side.In triangle ABC, AB + BC &gt; AC, AB + AC &gt; BC, and AC + BC &gt; AB. Examples:
École Normale Supérieure - MATH - Geo100
5.6 Parallels in Space Line perpendicular to a plane- A line that intersects the plane and is perpendicular to every line in the plane that passes through the point of intersection.Distance from a point to a plane - The length of the perpendicular segmen
École Normale Supérieure - MATH - Geo100
5.4 Conditions for Parallel Lines You can use converse statements to prove conjectures true. Converse of the Corresponding Angles Postulate- If 2 lines are intersected by a transversal and corresponding angles are congruent, then the 2 lines are _.Conver
École Normale Supérieure - MATH - Geo100
5.3 Types of Proofs Two Column Proof- A convincing argument organized into two columns (statements and reasons) that is used to show that a conjecture is true. Paragraph Proof A convincing argument written in complete sentences to show that a conjecture i
École Normale Supérieure - MATH - Geo100
5.2 Properties of Parallel Lines Think and Communicate (page 226) 1.)2.)Alternate Interior Angles Theorem If two parallel lines are intersected by a _, then alternate interior angles are _. Draw an exampleIf, then.Think and Communicate (page 227) 3.
École Normale Supérieure - MATH - Geo100
5.1 Parallel lines and Transversals Transversal- a line that intersects two or more lines in the same plane at different points.Same side interior angles- angles that lie on the same side of a transversal between the two lines it intersects.Alternate in
École Normale Supérieure - MATH - Geo100
NAME: Tell whether each pair of lines is parallel, perpendicular, or neither. 1.) y = 3/4 x + 2 y = - 4/3 x + 2 2.) y = 4x + 6 y = 4x - 3Find the slope of each line. 3. a line perpendicular to the line y = 3x + 2 4. a horizontal line that crosses the y-a
École Normale Supérieure - MATH - Geo100
Chapter 4 Section 3 Exploring Parallels and Perpendiculars Perpendicular bisector (p. 181) - A line, ray, or segment that intersects a given segment at it in Example: . and dividesSlopes of parallel and perpendicular linesParallel Lines Theorem: If two
École Normale Supérieure - MATH - Geo100
4.2 Equations of Lines The Slope Formula-(fill in the blanks and include all sketches or drawings) The , ) is: (m) of a containing the points ( , ) and (m= The slope of a The is of a . line is line .Checking Key Concepts page 1761.)= = Sketch the situ
École Normale Supérieure - MATH - Geo100
C hapter 4 Vocabula ryslope:y-intercept:slope-intercept form:perpendicula r bisector:circle:diameter of a circle:r ad ius ( r adi i):concent ric circles:coordinate geometry proof:three dimensional coordinate system:z-axis:ordered t r iple (x,
École Normale Supérieure - MATH - Geo100
Slope, Parallelism, &amp; PerpendicularityGiven a line in the plane, the ratio of the change in y to the change in x as you move from left to right is the slope of the line. If a line passes through two distinct points P1(x1, y1) and P2(x2, y2) where x1 give
École Normale Supérieure - MATH - Geo100
4.1 Examples Find the lengths of the sides of the polygon whose vertices are given. Give the most specific name for the polygon. 1. F(0, 1), G(6, 2), H(6, 4) FG= FG= FG= FG= GH= GH= GH= GH= FH= FH= FH= FH= 12. Q(2, 1), R(1, 4), S(4, 1), T(1, 2) QR= QR= QR
École Normale Supérieure - MATH - Geo100
Ch 3 sec 6 Pages 141-147 Pythagorean Theorem Leg- in a right triangle, each of the two shorter sides. Hypotenuse- in a right triangle, the side Proof of the Pythagorean theorem- Exploration (page 141) 2.)Area of the Square = the right angleTriangle 1 2 3
École Normale Supérieure - MATH - Geo100
Ch 3 sections 4, 5, and 7 Two-Column Proofs Two-column proof a proof format that contains statements and reasons arranged in two columns. Example 1 Theorem: The measure of an exterior angle of a triangle is equal to the sum of the measures of the two inte
École Normale Supérieure - MATH - Geo100
Ch3 sec 4Two-Column Proofs Two-column proof a proof format that contains statements and reasons arranged in two columns. Example 1 Theorem: The measure of an exterior angle of a triangle is equal to the sum of the measures of the two interior angles that
École Normale Supérieure - MATH - Geo100
Chapter 3 section 3 Proof - a chain of in which statements are placed in a logical order, with areason that everyone agrees is true given for each statement Theorem- a that can be proved to be trueParagraph proof- a proof that is written in Statement- t
École Normale Supérieure - MATH - Geo100
3.2 Postulates, Definitions, and propertiesPostulate - a Sketch the following.that is accepted without.If pt. Y is between pts. X and Z, then X, Y, and Z are collinear and XY + YZ = XZDefinition- the meaning of a word. An obtuse angle is an angle tha
École Normale Supérieure - MATH - Geo100
3.2 Postulates, Definitions, and propertiesPostulate - aSTATEMENTthat is accepted withoutPROOF.Sketch the following: If pt. Y is between pts. X and Z, then X, Y, and Z are collinear and XY + YZ = XZDefinition- the meaning of a word. An obtuse angle
École Normale Supérieure - MATH - Geo100
Ch 3 Section 1 Inductive and Deductive Reasoning Think and Communicate (page 111) 1.)2.)Inductive Reasoning: Example1: If it rains tonight, then it will be foggy in the morning. Deductive reasoning: involves using , and accepted properties in a Example
École Normale Supérieure - MATH - Geo100
Ch 2 Section 5 Opposite Parts of a Parallelogram: The opposite The of a parallelogram are of a parallelogram are . .If is athen,and.Ifis athen,and Complete the following table using your book. Term Definition.ExampleA quadrilateral with both pai
École Normale Supérieure - MATH - Geo100
2.6 Building PrismsTerm PrismDefinition a _ dimensional figure with _ congruent faces that are polygons that lie in parallel planesBaseone of the _ parallel faces of a prism A face of a _ that is not a base (These faces are formed by connecting corres