C/C++ Programming Style Guidelines
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
seminar surveyer
Active In SP
**

Posts: 3,541
Joined: Sep 2010
#1
03-01-2011, 10:50 AM




Fred Richards


.pdf   C & C++ Programming Style Guidlines.pdf (Size: 167.33 KB / Downloads: 55)

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 benefit 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 code’s 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’ 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?


File Contents

Use files to group functionality. Each file should contain only one cohesive set of functions. Avoid duplicating functionality in separate files. If different files contain similar functions, consider generalizing the function sufficiently and putting it into its own file 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 file.
Avoid strong coupling between functions and classes implemented in separate files. If two objects are so strongly coupled that one can only be used in conjunction with the other then they belong in the same file.
Use header files (.h suffix) to declare public interfaces, use code files (.c, .cc or .cpp suffix) to define implementations. Typically each cohesive set of functions you write in a single file will have one accompanying header/interface file pair. Code that uses your implementation will #include the header file.

Be precise with #include statements. Explicitly include the .h files you require, and only where you require them. If, for example, your code calls a function defined externally, include that function’s associated .h in your implementation file not in your code’s associated .h file. You should only need to include other files in your .h file if your public function interface or data type definitions require the definitions contained therein.
Avoid using header files to contain a set of #include directives simply for convenience. This “nesting” of #include constructs obscures file dependencies from the reader. It also creates a coupling between modules including the top-level header file. Unless the modules are cohesively coupled functionally, and each requires all the .h files included in the convenience header, it is preferable to instead include all the individual .h files everywhere they are required.




Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page

Quick Reply
Message
Type your reply to this message here.


Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  CGI PROGRAMMING LABORATORY seminar ideas 1 578 08-10-2014, 08:16 AM
Last Post: OtlBY
  Object Oriented Programming with Java seminar paper 2 1,067 18-09-2014, 03:24 PM
Last Post: Radhika.m
  Fundamental Programming Structures in C pdf seminar projects maker 0 378 26-09-2013, 12:36 PM
Last Post: seminar projects maker
  DATA STRUCTURES USED IN NETWORK PROGRAMMING seminar projects maker 0 557 25-09-2013, 04:27 PM
Last Post: seminar projects maker
  Programming Language Theory ICS313 seminar projects maker 0 309 24-09-2013, 02:03 PM
Last Post: seminar projects maker
  Tutorial On Introduction to 8085 Architecture and Programming seminar projects maker 0 377 20-09-2013, 03:52 PM
Last Post: seminar projects maker
  VHDL CODING STYLE AND PROGRAMING CONCEPT REPORT seminar projects maker 0 297 12-09-2013, 02:21 PM
Last Post: seminar projects maker
  UNIX SYSTEM PROGRAMMING pdf seminar projects maker 0 412 11-09-2013, 03:42 PM
Last Post: seminar projects maker
  Introduction to Microsoft Kinect Sensor Programming PPT study tips 0 402 10-09-2013, 12:02 PM
Last Post: study tips
  Test Plan Definition, Types, Template, and Guidelines: study tips 0 310 21-08-2013, 02:37 PM
Last Post: study tips