C Language: A Style Guide
|
|
- Patrick Norton
- 6 years ago
- Views:
Transcription
1 C Language: A Style Guide Antón Gómez, october 2010 Introduction This guide proposes a set of basic rules, studied to favor the writing of clean code. In order to understand why is it necessary to keep certain rules in mind when writing software, it is important to be aware of the dimensions that complex software projects have. Lets see some examples: Application Description Lines of code Windows XP Full fledged operating system. 40 millones Linux Kernel Operating system kernel. 8.4 millones Subversion Revision control system. 417 K Google Chrome Web browser. 1.5 millones (C++) 1.4 millones (C) PHP Scripting engine for active web pages. 800 K The Gimp Image manipulation suite. 675 K VLC Media Player Multimedia player. 341 K (C), 93 K (C++) When a program is made of several hundred thousand lines of code, or maybe several million, writing it in such a way that is very easy to read and understand is of paramount importance. Otherwise, the simplest change would require an incredibly big amount of effort (effort equals money). It is also important to understand that code is normally written once, but read dozens of times: for bug fixing, to understand its inner workings before modifying it, or in order to write other modules that have to interact with it. The norm in industry is that code is going to be read constantly by people not involved in its writing.
2 Code organization C code is organized in.c and.h files. For every.c file there shall be a.h file with the same name (list.c, list.h). This pair of files is called a module..c files are not a pool of functions. The key to organizing C code in several files and avoid cross dependency issues, is to understand that what in modern languages is naturally managed as objects, in C are the modules. Every module (or object if you wish), has a public interface declared in its.h file, and a collection of private variables and functions hidden inside the.c file. Public declarations are placed in the.h file so other modules can use them by means of an #include directive, and private definitions are kept withing the.c file marked as static, so they can not be used from outside the module. Every.c file shall include its own.h file. (list.c would #include list.h)..h files shall only contain public declarations: types, constants, global variables and function prototypes designed to be used from outside the module. Everything else goes in the.c file. Every.h file shall contain guards for avoiding multiple inclusions. #ifndef _LIST_H_ #define _LIST_H_... public interface... #endif /* _LIST_H_ */ Global variables shall be defined together at the beginning of the.c file, so they can be identified quickly. They shall never be spread throughout the file. One consequence of this rule is that it is convenient to split struct definitions from the definition of global variables of type struct. Types are defined by themselves (in a.h file if public, in a.c file if private), and then globals are defined separately by using these types. #include param_db.h struct param_entry char param[param_max_len]; char value[value_max_len]; char default[value_max_len]; ; struct param_list struct param_entry param; struct list_node * next; ; /* Globals */ int error_code; static struct param_list * param_map; #include param_db.h struct param_entry char param[param_max_len]; char value[value_max_len]; char default[value_max_len]; ; static struct param_list struct param_entry param; struct list_node * next; param_map; int error_code; Identifiers Identifiers for functions and variables must be short, descriptive and specific. File names
3 too. struct tcp_header header; bool is_enabled; int parse_xml_file(file * file); void init_user_interface(void); list.c xml_parser.c math.c struct tcp_header b; bool tmp; int open_xml_file_and_get_content(file * f); void ui(void); types.h utils.c code3.c Identifiers for functions and variables must be written in lower case and if they are composed of several words, each word must be split by a '_' character. Macros and constants shall be written in upper case so they can be distinguished from functions and variables. Format The code shall be indented to represent its logical structure. Tab must be used as indentation character, not spaces. It is recommended to have the code editor setup to show 4 spaces per tab. Curly brackets shall be placed following the Allman standard, also known as BSD. This is, in the next line of if or while sentences, for example. See examples at the end of this section. Function bodies shall fit in the screen completely. It should not be necessary to scroll down to read the full body, although sometimes it may be necessary to write slightly longer functions. In any case, never write functions that exceed the space of two screens. Lines shall not exceed 80 columns.
4 Example of a nicely formatted code: int i, retval = 0, result = 0; for (i = 0; i < P_SIZE; i++) else LOG_WARNING( No callback for param %d, i); return result; Example of badly formatted code: int i, retval = 0, result = 0; for (i = 0; i < P_SIZE; i++) else LOG_WARNING( No callback for param %d, i); return result;
5 Preprocessor usage Macros shall be used for specifying array dimensions, so they are easy to read and modify. They are frequently used for defining other constants as well. #define TIMEOUT_SECS 120 #define MAX_LINE_SIZE 80 char input_line[max_line_size]; timer = set_timer(timeout_secs); Comments All functions defined in a.c file, being private or public (static), shall contain a comment header above saying in a line or two what they do. You can also add comments to particularities of function inner workings to this header. /* * db_sync() * Synchronizes the internal database with the firmware files by storing * modified parameters on permanent storage. * * Any parameter marked as "dirty" will be dumped by calling its associated * sync callback. */ Comments shall be added to non trivial sections of the code. In very rare situations it is required to add comments to individual lines. If the source code is properly written, it is not necessary to repeat in a comment what is already written in C. /* Call synchronization callback for parameters * marked dirty. Clear dirty flag if callback * succeedes. */ /* Call sync_cb */ /* Set dirty flag to false ª/
MRO Delay Line. Coding and Documentation Guidelines for Prototype Delay Line Software. John Young. rev June 2007
MRO Delay Line Coding and Documentation Guidelines for Prototype Delay Line Software John Young rev 0.5 21 June 2007 Cavendish Laboratory Madingley Road Cambridge CB3 0HE UK Objective To propose a set
More informationCoding Standards for C
Why have coding standards? Coding Standards for C Version 6.3 It is a known fact that 80% of the lifetime cost of a piece of software goes to maintenance. Therefore it makes sense for all programs within
More informationCE221 Programming in C++ Part 1 Introduction
CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab
More informationA Fast Review of C Essentials Part II
A Fast Review of C Essentials Part II Structural Programming by Z. Cihan TAYSI Outline Macro processing Macro substitution Removing a macro definition Macros vs. functions Built-in macros Conditional compilation
More informationRule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.
Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public
More informationCoding Standards for C
Why have coding standards? Coding Standards for C Version 6.1 CS480s11 It is a known fact that 80% of the lifetime cost of a piece of software goes to maintenance. Therefore it makes sense for all programs
More informationSlide Set 5. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary
Slide Set 5 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2016 ENCM 339 Fall 2016 Slide Set 5 slide 2/32
More informationMakefiles Makefiles should begin with a comment section of the following form and with the following information filled in:
CS 215 Fundamentals of Programming II C++ Programming Style Guideline Most of a programmer's efforts are aimed at the development of correct and efficient programs. But the readability of programs is also
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationExercise Session 2 Systems Programming and Computer Architecture
Systems Group Department of Computer Science ETH Zürich Exercise Session 2 Systems Programming and Computer Architecture Herbstsemester 216 Agenda Linux vs. Windows Working with SVN Exercise 1: bitcount()
More informationCPSC 427: Object-Oriented Programming
CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 12 October 8, 2018 CPSC 427, Lecture 12, October 8, 2018 1/24 Uses of Pointers Feedback on Programming Style CPSC 427, Lecture 12, October
More informationEL6483: Brief Overview of C Programming Language
EL6483: Brief Overview of C Programming Language EL6483 Spring 2016 EL6483 EL6483: Brief Overview of C Programming Language Spring 2016 1 / 30 Preprocessor macros, Syntax for comments Macro definitions
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationSoftware Coding Guidelines
General Software Coding Guidelines Last update 30 Aug 2016 [MLS] Coding is the last step in translating a design into an executable program. As such, coding is different from design or documentation. There
More informationPIC 10A Objects/Classes
PIC 10A Objects/Classes Ernest Ryu UCLA Mathematics Last edited: November 13, 2017 User-defined types In C++, we can define our own custom types. Object is synonymous to variable, and class is synonymous
More informationCSE 333 Autumn 2014 Midterm Key
CSE 333 Autumn 2014 Midterm Key 1. [3 points] Imagine we have the following function declaration: void sub(uint64_t A, uint64_t B[], struct c_st C); An experienced C programmer writes a correct invocation:
More informationCSC 126 FINAL EXAMINATION Spring Total Possible TOTAL 100
CSC 126 FINAL EXAMINATION Spring 2011 Version A Name (Last, First) Your Instructor Question # Total Possible 1. 10 Total Received 2. 15 3. 15 4. 10 5. 10 6. 10 7. 10 8. 20 TOTAL 100 Name: Sp 11 Page 2
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationWeek - 01 Lecture - 04 Downloading and installing Python
Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and
More informationCAAM 420 Fall 2012 Lecture 15. Roman Schutski
CAAM 420 Fall 2012 Lecture 15 Roman Schutski December 2, 2012 Table of Contents 1 Using make. Structures. 3 1.1 Makefiles...................................... 3 1.1.1 Syntax...................................
More informationC / C++ Coding Rules
C / C++ Coding Rules Luca Abeni luca.abeni@unitn.it March 3, 2008 Abstract This short document collects some simple and stupid coding rules for writing understandable C or C++ code, and has been written
More informationThe Structure of a C++ Program
Steven Zeil May 25, 2013 Contents 1 Separate Compilation 3 1.1 Separate Compilation.......... 4 2 Pre-processing 7 2.1 #include.................. 9 2.2 Other Pre-processing Commands... 14 3 Declarations
More informationTopic 6: A Quick Intro To C. Reading. "goto Considered Harmful" History
Topic 6: A Quick Intro To C Reading Assumption: All of you know basic Java. Much of C syntax is the same. Also: Some of you have used C or C++. Goal for this topic: you can write & run a simple C program
More informationCSE 143. Programming is... Principles of Programming and Software Engineering. The Software Lifecycle. Software Lifecycle in HW
Principles of Programming and Software Engineering Textbook: hapter 1 ++ Programming Style Guide on the web) Programming is......just the beginning! Building good software is hard Why? And what does "good"
More informationProgramming. Projects with Multiple Files
Programming Projects with Multiple Files Summary } GCC } Multiple source files 2 Source Code with Multiple Files } Make multiple, separate source code files which can be combined into one executable }
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #54. Organizing Code in multiple files
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #54 Organizing Code in multiple files (Refer Slide Time: 00:09) In this lecture, let us look at one particular
More informationC++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace
C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your
More informationindependent compilation and Make
independent compilation and Make Geoffrey Brown David S. Wise Chris Haynes Bryce Himebaugh Computer Structures Fall 2013 Independent Compilation As a matter of style, source code files should rarely be
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationA function is a named piece of code that performs a specific task. Sometimes functions are called methods, procedures, or subroutines (like in LC-3).
CIT Intro to Computer Systems Lecture # (//) Functions As you probably know from your other programming courses, a key part of any modern programming language is the ability to create separate functions
More informationIntroduction to C++ Coding Style How to Program Beautifully?
Introduction to C++ Coding Style How to Program Beautifully? ACM Honoured Class, SJTU Sept. 29, 2013 Contents I Header Files Inline Functions Function Parameter Ordering Names and Order of Includes Scoping
More informationCSCE 110 PROGRAMMING FUNDAMENTALS
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class Prof. amr Goneid, AUC 1 Dictionaries(1): A Key Table Class Prof. Amr Goneid, AUC 2 A Key Table
More informationLecture Notes on Generic Data Structures
Lecture Notes on Generic Data Structures 15-122: Principles of Imperative Computation Frank Pfenning Lecture 22 November 15, 2012 1 Introduction Using void* to represent pointers to values of arbitrary
More informationG52CPP C++ Programming Lecture 9
G52CPP C++ Programming Lecture 9 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Last lecture const Constants, including pointers The C pre-processor And macros Compiling and linking And
More informationNEXT SET OF SLIDES FROM DENNIS FREY S FALL 2011 CMSC313.
NEXT SET OF SLIDES FROM DENNIS FREY S FALL 2011 CMSC313 http://www.csee.umbc.edu/courses/undergraduate/313/fall11/" C Programming Functions Program Organization Separate Compilation Functions vs. Methods
More informationTopic 6: A Quick Intro To C
Topic 6: A Quick Intro To C Assumption: All of you know Java. Much of C syntax is the same. Also: Many of you have used C or C++. Goal for this topic: you can write & run a simple C program basic functions
More informationCSCI 2101 Java Style Guide
CSCI 2101 Java Style Guide Fall 2017 This document describes the required style guidelines for writing Java code in CSCI 2101. Guidelines are provided for four areas of style: identifiers, indentation,
More informationChapter 1 Getting Started
Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different
More informationMachine Problem 1: A Simple Memory Allocator
Machine Problem 1: A Simple Memory Allocator Introduction In this machine problem, you are to develop a simple memory allocator that implements the functions my malloc() and my free(), very similarly to
More informationCSCI 262 C++ Style Guide
CSCI 262 C++ Style Guide Christopher Painter-Wakefield and Mark Baldwin and Alex Anderson Last updated: 1/18/2018 Modified from: C++ Student Coding Standards Mark Baldwin Version 1.02 5/21/2013 2012 Mark
More informationC++ Coding Standards and Practices. Tim Beaudet March 23rd 2015
C++ Coding Standards and Practices Tim Beaudet (timbeaudet@yahoo.com) March 23rd 2015 Table of Contents Table of contents About these standards Project Source Control Build Automation Const Correctness
More informationThe Go Programming Language. Frank Roberts
The Go Programming Language Frank Roberts frank.roberts@uky.edu - C++ (1983), Java (1995), Python (1991): not modern - Java is 18 years old; how has computing changed in 10? - multi/many core - web programming
More informationAny of the descriptors in the set {1, 4} have an exception condition pending
Page 1 of 6 6.3 select Function This function allows the process to instruct the kernel to wait for any one of multiple events to occur and to wake up the process only when one or more of these events
More informationTypeChef: Towards Correct Variability Analysis of Unpreprocessed C Code for Software Product Lines
TypeChef: Towards Correct Variability Analysis of Unpreprocessed C Code for Software Product Lines Paolo G. Giarrusso 04 March 2011 Software product lines (SPLs) Feature selection SPL = 1 software project
More informationChapter 19: Program Design. Chapter 19. Program Design. Copyright 2008 W. W. Norton & Company. All rights reserved.
Chapter 19 Program Design 1 Introduction Most full-featured programs are at least 100,000 lines long. Although C wasn t designed for writing large programs, many large programs have been written in C.
More informationPIC 10A. Lecture 17: Classes III, overloading
PIC 10A Lecture 17: Classes III, overloading Function overloading Having multiple constructors with same name is example of something called function overloading. You are allowed to have functions with
More informationOverview of today s lecture. Quick recap of previous C lectures. Introduction to C programming, lecture 2. Abstract data type - Stack example
Overview of today s lecture Introduction to C programming, lecture 2 -Dynamic data structures in C Quick recap of previous C lectures Abstract data type - Stack example Make Refresher: pointers Pointers
More informationChapter 2. Operating-System Structures
Chapter 2 Operating-System Structures 2.1 Chapter 2: Operating-System Structures Operating System Services User Operating System Interface System Calls Types of System Calls System Programs Operating System
More informationSystem Programming And C Language
System Programming And C Language Prof. Jin-soo Kim. (jinsookim@skku.edu) Pintos TA Jin-yeong, Bak. (dongdm@gmail.com) Kyung-min, Go. (gkm2164@gmail.com) 2010.09.28 1 Contents Important thing in system
More informationC Coding standard. Raphael kena Poss. July Introduction 2. 3 File system layout 2
C Coding standard Raphael kena Poss July 2014 Contents 1 Introduction 2 2 Systems programming @ VU Amsterdam 2 3 File system layout 2 4 Code style 3 4.1 Comments and preprocessor.................................
More informationC PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5
C PROGRAMMING LANGUAGE. POINTERS, ARRAYS, OPERATORS AND LOOP. CAAM 519, CHAPTER5 1. Pointers As Kernighan and Ritchie state, a pointer is a variable that contains the address of a variable. They have been
More informationP.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above
P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above
More informationPre Lab (Lab-1) Scrutinize Different Computer Components
Pre Lab (Lab-1) Scrutinize Different Computer Components Central Processing Unit (CPU) All computer programs have functions, purposes, and goals. For example, spreadsheet software helps users store data
More informationAssignment 5: Priority Queue
Assignment 5: Priority Queue Topic(s): Priority Queues, Code Reusability, More Advanced Makefiles, Debugging, Testing Date assigned: Wednesday, October 18, 2017 Date due: Wednesday, November 1, 2017, 9:15
More informationChris' Makefile Tutorial
Chris' Makefile Tutorial Chris Serson University of Victoria June 26, 2007 Contents: Chapter Page Introduction 2 1 The most basic of Makefiles 3 2 Syntax so far 5 3 Making Makefiles Modular 7 4 Multi-file
More informationExercise Session 2 Simon Gerber
Exercise Session 2 Simon Gerber CASP 2014 Exercise 2: Binary search tree Implement and test a binary search tree in C: Implement key insert() and lookup() functions Implement as C module: bst.c, bst.h
More informationAn Introduction to C++
An Introduction to C++ Introduction to C++ C++ classes C++ class details To create a complex type in C In the.h file Define structs to store data Declare function prototypes The.h file serves as the interface
More informationObjectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators
Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)
More information1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?
1. Describe History of C++? The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity
More informationCS 326 Operating Systems C Programming. Greg Benson Department of Computer Science University of San Francisco
CS 326 Operating Systems C Programming Greg Benson Department of Computer Science University of San Francisco Why C? Fast (good optimizing compilers) Not too high-level (Java, Python, Lisp) Not too low-level
More informationCS 580 FINAL EXAM. Fall April 29, 2014
CS 580 FINAL EXAM Fall 201 April 29, 2014 You are to build a range tree for your final exam. A range tree is a tree where each node contains a minimum and a maximum value as well as a linked list to store
More informationWorkspace for '3-ctips' Page 1 (row 1, column 1)
Workspace for '3-ctips' Page 1 (row 1, column 1) ECEN 449 Microprocessor System Design Some tips to good programming and Makefiles 1 Objectives of this Lecture Unit Some tips to good programming 2 Variable
More informationLecture 7. Log into Linux New documents posted to course webpage
Lecture 7 Log into Linux New documents posted to course webpage Coding style guideline; part of project grade is following this Homework 4, due on Monday; this is a written assignment Project 1, due next
More information7.1 Optional Parameters
Chapter 7: C++ Bells and Whistles A number of C++ features are introduced in this chapter: default parameters, const class members, and operator extensions. 7.1 Optional Parameters Purpose and Rules. Default
More informationChapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.
Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)
More informationCrash Course in C++ R F L Evans. www-users.york.ac.uk/~rfle500/
Crash Course in C++ R F L Evans www-users.york.ac.uk/~rfle500/ Course overview Lecture 1 - Introduction to C++ Lecture 2 - Functions and Data Lecture 3 - Namespaces and Files Lecture 4 - Code Organization
More informationIII. Classes (Chap. 3)
III. Classes III-1 III. Classes (Chap. 3) As we have seen, C++ data types can be classified as: Fundamental (or simple or scalar): A data object of one of these types is a single object. int, double, char,
More informationC Formatting Guidelines
UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO C PROGRAMMING SPRING 2012 C Formatting Guidelines Lines & Spacing 1. 100 character lines (tabs count
More informationLecture Notes on Generic Data Structures
Lecture Notes on Generic Data Structures 15-122: Principles of Imperative Computation Frank Pfenning, Penny Anderson Lecture 21 November 7, 2013 1 Introduction Using void* to represent pointers to values
More informationObject-Oriented Programming
iuliana@cs.ubbcluj.ro Babes-Bolyai University 2018 1 / 37 Overview 1 2 3 4 5 2 / 37 Questions we will answer today What is the difference between the stack and the heap? How can we allocate and free memory
More informationSlide Set 6. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng
Slide Set 6 for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2017 ENCM 339 Fall 2017 Section 01 Slide
More information4.8 Summary. Practice Exercises
Practice Exercises 191 structures of the parent process. A new task is also created when the clone() system call is made. However, rather than copying all data structures, the new task points to the data
More informationLinked List using a Sentinel
Linked List using a Sentinel Linked List.h / Linked List.h Using a sentinel for search Created by Enoch Hwang on 2/1/10. Copyright 2010 La Sierra University. All rights reserved. / #include
More informationObject Oriented Programming COP3330 / CGS5409
Object Oriented Programming COP3330 / CGS5409 Intro to Data Structures Vectors Linked Lists Queues Stacks C++ has some built-in methods of storing compound data in useful ways, like arrays and structs.
More informationCS3157: Advanced Programming. Outline
CS3157: Advanced Programming Lecture #8 Feb 27 Shlomo Hershkop shlomo@cs.columbia.edu 1 Outline More c Preprocessor Bitwise operations Character handling Math/random Review for midterm Reading: k&r ch
More informationCS Final Exam Review Suggestions - Spring 2014
CS 111 - Final Exam Review Suggestions p. 1 CS 111 - Final Exam Review Suggestions - Spring 2014 last modified: 2014-05-09 before lab You are responsible for material covered in class sessions, lab exercises,
More informationIntroduction CHAPTER. Review Questions
1 CHAPTER Introduction Review Questions Section 1.1 1.1 What are the four components of a computer system? 1.2 Provide at least three resources the operating system allocates. 1.3 What is the common name
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationME 461 C review Session Fall 2009 S. Keres
ME 461 C review Session Fall 2009 S. Keres DISCLAIMER: These notes are in no way intended to be a complete reference for the C programming material you will need for the class. They are intended to help
More informationCS 351 Design of Large Programs Coding Standards
CS 351 Design of Large Programs Coding Standards Brooke Chenoweth University of New Mexico Spring 2018 CS-351 Coding Standards All projects and labs must follow the great and hallowed CS-351 coding standards.
More informationObject-Oriented Design (OOD) and C++
Chapter 2 Object-Oriented Design (OOD) and C++ At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Questions Projects to Assign
More informationCS Programming In C
CS 24000 - Programming In C Week Two: Basic C Program Organization and Data Types Zhiyuan Li Department of Computer Science Purdue University, USA 2 int main() { } return 0; The Simplest C Program C programs
More informationCpt S 122 Data Structures. Introduction to C++ Part II
Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function
More informationUse C++, not C for all work in this course. The biggest difference is how one does input
Chapter 1: Preamble 1.1 Commandments A nationally-known expert has said that C++ is a coding monster that forces us to use a disciplined style in order to tame it. This leads to a fundamental rule for
More informationComp Sci 1570 Introduction to C++
guards Comp Sci 1570 Introduction to C++ Outline guards 1 2 guards 3 Outline guards 1 2 guards 3 Modular guards One file before system includes prototypes main driver function function definitions now
More informationCSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 C: Linked list, casts, the rest of the preprocessor (Thanks to Hal Perkins)
CSE 374 Programming Concepts & Tools Brandon Myers Winter 2015 C: Linked list, casts, the rest of the preprocessor (Thanks to Hal Perkins) Linked lists, trees, and friends Very, very common data structures
More informationChapter 1 INTRODUCTION
Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer
More informationComputer Science BS Degree - Data Structures (I2206) Abstract Data Types (ADT)
Abstract Data Types (ADT) 70 Hierarchy of types Each type is implemented in terms if the types lower in the hierarchy Level 0 Bit Byte Word Level 1 Integer Real Char Boolean Pointer Level 2 Array Record
More informationLAT-TD-xxxxx-xx May 21, 2002
Document # Date LAT-TD-xxxxx-xx May 21, 2002 Author(s) Supersedes Page 1 of 12 LAT TECHNICAL NOTE System or Sponsoring Office Science Analysis Software Document Title SAS Recommendations for Code Documentation
More informationECE 362 Lab Verification / Evaluation Form Experiment 5
ECE 362 Lab Verification / Evaluation Form Experiment 5 Evaluation: IMPORTANT! You must complete this experiment during your scheduled lab perior. All work for this experiment must be demonstrated and
More informationOutline. COMP 2718: Software Development Tools: gcc and make. C and Java 3/28/16
Outline COMP 2718: Software Development Tools: gcc and make Slides adapted by Andrew Vardy ( Memorial University) Originally created by Marty Stepp, Jessica Miller, and Ruth Anderson (University of Washington)
More informationEnabling Variability-Aware Software Tools. Paul Gazzillo New York University
Enabling Variability-Aware Software Tools Paul Gazzillo New York University We Need Better C Tools Linux and other critical systems written in C Need source code browsers 20,000+ compilation units, 10+
More informationCPSC 427: Object-Oriented Programming
CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 3 September 7, 2016 CPSC 427, Lecture 3 1/27 Insertion Sort Example Program specification Monolithic solution Modular solution in C Modular
More informationBetter variadic functions in C
Better variadic functions in C Ben Klemens XXX I really dislike how C s variadic functions are implemented. I think they create lots of problems and don t fulfil their potential. So this is my effort to
More informationThe Structure of a C++ Program
Steven Zeil August 31, 2013 Contents 1 Separate Compilation 2 1.1 Separate Compilation.......... 3 2 Pre-processing 5 2.1 #include.................. 7 2.2 Other Pre-processing Commands... 10 3 Declarations
More informationCOMP322 - Introduction to C++ Lecture 02 - Basics of C++
COMP322 - Introduction to C++ Lecture 02 - Basics of C++ School of Computer Science 16 January 2012 C++ basics - Arithmetic operators Where possible, C++ will automatically convert among the basic types.
More informationCSci 4061 Introduction to Operating Systems. Programs in C/Unix
CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,
More informationCSE 333 Midterm Exam July 24, Name UW ID#
Name UW ID# There are 6 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes,
More informationCS2141 Software Development using C/C++ Compiling a C++ Program
CS2141 Software Development using C/C++ Compiling a C++ Program g++ g++ is the GNU C++ compiler. A program in a file called hello.cpp: #include using namespace std; int main( ) { cout
More informationCS201 - Lecture 1 The C Programming Language
CS201 - Lecture 1 The C Programming Language RAOUL RIVAS PORTLAND STATE UNIVERSITY History of the C Language The C language was invented in 1970 by Dennis Ritchie Dennis Ritchie and Ken Thompson were employees
More information