CERT C Rules implemented in the LDRA tool suite
|
|
- Edwin Greene
- 5 years ago
- Views:
Transcription
1 CERT C Rules implemented in the LDRA tool suite This section lists a snapshot of the CERT C Coding Standard guidelines in 2014 that are automatically checked by version of the LDRA tool suite. Guidelines Definition Total Implemented by LDRA 75 Enhanced Enforcement of rule by LDRA 47 Partially implemented by LDRA 78 Not yet implemented by LDRA 22 Deemed to be not statically analyzable by a tool 42 Total 264 CERT C PRE Guideline PRE00-C PRE01-C PRE02-C PRE03-C PRE04-C PRE05-C PRE06-C PRE07-C PRE08-C PRE09-C PRE10-C PRE11-C PRE12-C PRE13-C PRE30-C PRE31-C PRE32-C Prefer inline or static functions to function-like macros Use parentheses within macros around parameter names Macro replacement lists should be parenthesized Prefer typedefs to defines for encoding types Do not reuse a standard header file name Understand macro replacement when concatenating tokens or performing stringification Enclose header file in an inclusion guard Avoid using repeated question marks Guarantee that header filenames are unique Do not replace secure functions with less secure functions Wrap multistatement macros in a do-while loop Do not conclude macro definitions with a semicolon Do not define unsafe macros Use the Standard predefined macros to test for versions and features. Do not create a universal character name through concatenation Avoid side effects in arguments to unsafe macros Do not use preprocessor directives in invocations of function-like macros CERT C DCL Guideline DCL00-C DCL01-C DCL02-C DCL03-C DCL04-C DCL05-C Const-qualify immutable objects Do not reuse variable names in subscopes Use visually distinct identifiers Use a static assertion to test the value of a constant expression Do not declare more than one variable per declaration Use typedefs of non-pointer types only
2 DCL06-C DCL07-C DCL08-C DCL09-C DCL10-C DCL11-C DCL12-C DCL13-C DCL15-C DCL16-C DCL17-C DCL18-C DCL19C DCL20-C DCL21-C DLC22-C DCL23-C DCL30-C DCL31-C DCL36-C DCL37-C DCL38-C DCL39-C DCL40-C DCL41-C Use meaningful symbolic constants to represent literal values in program logic Include the appropriate type information in function declarators Properly encode relationships in constant definitions Declare functions that return an errno with a return type of errno_t Maintain the contract between the writer and caller of variadic functions Understand the type issues associated with variadic functions Implement abstract data types using opaque types Declare function parameters that are pointers to values not changed by the function as const Declare objects that do not need external linkage with storage-class specifier static Use "L," not "l," to indicate a long value Beware of miscompiled volatile-qualified variables Do not begin integer constants with 0 when specifying a decimal value Minimize the scope of variables and functions Explicitly specify void when a function accepts no arguments Understand the storage of compound literals Use volatile for data that cannot be cached Guarantee that mutually visible identifiers are unique Declare objects with appropriate storage durations Declare identifiers before using them Do not declare an identifier with conflicting linkage classifications Do not declare or define a reserved identifier Use the correct syntax when declaring flexible array members Avoid information leak in structure padding Do not create incompatible declarations of the same function or object Do not declare variables inside a switch statement before the first case label CERT C EXP Guideline EXP00-C EXP02-C EXP03-C EXP05-C EXP07-C EXP08-C EXP09-C Use parentheses for precedence of operation Be aware of the short-circuit behavior of the logical AND and OR operators Do not assume the size of a structure is the sum of the of the sizes of its members Do not cast away a const qualification Do not diminish the benefits of constants by assuming their values in expressions Ensure pointer arithmetic is used correctly Use sizeof to determine the size of a type or variable
3 EXP10-C EXP11-C EXP12-C EXP13-C EXP15-C EXP16-C EXP19-C EXP20-C EXP30-C EXP32-C EXP33-C EXP34-C EXP35-C EXP36-C EXP37-C EXP39-C EXP40-C EXP42-C EXP43-C EXP44-C EXP45-C EXP46-C Do not depend on the order of evaluation of subexpressions or the order in which side effects take place Do not make assumptions regarding the layout of structures with bitfields Do not ignore values returned by functions Treat relational and equality operators as if they were nonassociative Do not place a semicolon on the same line as an if, for, or while statement Do not compare function pointers to constant values Use braces for the body of an if, for, or while statement Perform explicit tests to determine success, true and false, and equality Do not depend on order of evaluation between sequence points Do not access a volatile object through a nonvolatile reference Do not read uninitialized memory Do not dereference null pointers Do not modify objects with temporary lifetime Do not cast pointers into more strictly aligned pointer types Call functions with the correct number and type of arguments Do not access a variable through a pointer of an incompatible type Do not modify constant objects Do not compare padding data Avoid undefined behaviors when using restrict-qualified pointers Do not rely on side effects in operands to sizeof, _Alignof, or _Generic Do not perform assignments in selection statements Do not use a bitwise operator with a Boolean-like operand CERT C INT Guideline INT00-C INT01-C INT02-C INT04-C INT05-C INT06-C INT07-C INT08-C INT09-C INT10-C Understand the data model used by your implementation(s) Use rsize_t or size_t for all integer values representing the size of an object Understand integer conversion rules Enforce limits on integer values originating from untrusted sources Do not use input functions to convert character data if they cannot handle all possible inputs Use strtol() or a related function to convert a string token to an integer Use only explicitly signed or unsigned char type for numeric values Verify that all integer values are in range Ensure enumeration constants map to unique values Do not assume a positive remainder when using the % operator
4 INT12-C INT13-C INT14-C INT15-C INT16-C INT17-C INT18-C INT30-C INT31-C INT32-C INT33-C INT34-C INT35-C INT36-C Do not make assumptions about the type of a plain int bit-field when used in an expression Use bitwise operators only on unsigned operands Avoid performing bitwise and arithmetic operations on the same data Use intmax_t or uintmax_t for formatted I/O on programmer-defined integer types Do not make assumptions about representation of signed integers Define integer constants in an implementation-independent manner Evaluate integer expressions in a larger size before comparing or assigning to that size Ensure that unsigned integer operations do not wrap Ensure that integer conversions do not result in lost or misinterpreted data Ensure that integer operations on signed integers do not result in an overflow Ensure that division and modulo operations do not result in divideby-zero errors Do not shift a negative number of bits or more bits than exist in the operand Use correct integer precisions Converting a pointer to integer or integer to pointer CERT C FLP Guideline FLP00-C FLP01-C FLP02-C FLP03-C FLP04-C FLP05C FLP06-C FLP07-C FLP30-C FLP32-C FLP34-C FLP36-C FLP37-C Understand the limitations of floating-point numbers Take care in rearranging floating point expressions Avoid using floating-point numbers when precise computation is needed Detect and handle floating-point errors Check floating-point inputs for exceptional values Don't use denormalized numbers Convert integers to floating point for floating-point operations Cast the return value of a function that returns a floating-point type Do not use floating-point variables as loop counters Prevent or detect domain and range errors in math functions Ensure that floating-point conversions are within range of the new type Preserve precision when converting integral values to floating-point type Do not use object representations to compare floating-point values CERT C ARR Guideline ARR00-C ARR01-C ARR02-C ARR30-C Understand how arrays work Do not apply the size of operator to a pointer when taking the size of an array Explicitly specify array bounds, even if implicitly defined by an initializer Do not form or use out-of-bounds pointers or array subscripts
5 ARR31-C ARR32-C ARR36-C ARR37-C ARR38-C ARR39-C Use consistent array notation across all source files Ensure size arguments for variable length arrays are in a valid range Do not subtract or compare two pointers that do not refer to the same array Do not add or subtract an integer to a pointer to a non-array object Guarantee that library functions do not form invalid pointers Do not add or subtract a scaled integer to a pointer CERT C STR Guideline STR00-C STR01-C STR02-C STR03-C STR04-C STR05-C STR06-C STR07-C STR09-C STR10-C STR11-C STR30-C STR31-C STR32-C STR34-C STR37-C STR38-C Represent characters using an appropriate type Adopt and implement a consistent plan for managing strings Sanitize data passed to complex subsystems Do not inadvertently truncate a null-terminated byte string Use plain char for characters in the basic character set Use pointers to const when referring to string literals Do not assume that strtok() leaves the parse string unchanged Use the bounds-checking interfaces for string manipulation Don't assume numeric values for expressions with type plain character Do not concatenate different type of string literals Do not specify the bound of a character array initialized with a string literal Do not attempt to modify string literals Guarantee that storage for strings has sufficient space for character data and the null terminator Do not pass a non-null-terminated character sequence to a library function that expects a string Cast characters to unsigned types before converting to larger integer sizes Arguments to character-handling functions must be representable as an unsigned char Do not confuse narrow and wide character strings and functions CERT C MEM Guideline MEM00-C MEM01-C MEM02-C MEM03-C MEM04-C MEM05-C MEM06-C Allocate and free memory in the same module at the same level of abstraction Store a new value in pointers immediately after free() Immediately cast the result of a memory allocation function call into a pointer to the allocated type Clear sensitive information stored in reusable resources returned for reuse Do not perform zero-length allocations Avoid large stack allocations Ensure that sensitive data is not written out to disk
6 MEM07-C MEM10-C MEM11-C MEM12-C MEM30-C MEM31-C MEM33-C MEM34-C MEM35-C MEM36-C Ensure that the arguments to calloc(), when multiplied, do not wrap Define and use a pointer validation function Do not assume infinite heap space Consider using a goto chain when leaving a function on error when using and releasing resources Do not access freed memory Free dynamically allocated memory exactly once Allocate and copy structures containing a flexible array member dynamically Only free memory allocated dynamically Allocate sufficient memory for an object Do not modify the alignment of objects by calling realloc() CERT C FIO Guideline FIO01-C FIO02-C FIO03-C FIO05-C FIO06-C FIO08-C FIO09-C FIO10-C FIO11-C FIO13-C FIO14-C FIO15-C FIO17-C FIO18-C FIO19-C FIO20-C FIO21-C FIO22-C FIO23-C FIO30-C FIO31-C FIO32-C FIO37-C FIO38-C Be careful using functions that use file names for identification Canonicalize path names originating from untrusted sources Do not make assumptions about fopen() and file creation Identify files using multiple file attributes Create files with appropriate access permissions Take care when calling remove() on an open file Be careful with binary data when transferring data across systems Take care when using the rename() function Take care when specifying the mode parameter of fopen() Never push back anything other than one read character Understand the difference between text mode and binary mode with file streams Ensure that file operations are performed in a secure directory Do not rely on an ending null character when using fread() Never expect fwrite() to terminate the writing process at a null character Do not use fseek() and ftell() to compute the size of a regular file Avoid unintentional truncation when using fgets() or fgetws() Do not create temporary files in shared directories Close files before spawning processes Do not exit with unflushed data in stdout or stderr Exclude user input from format strings Do not open a file that is already open Do not perform operations on devices that are only appropriate for files Do not assume that fgets() or fgetws() returns a nonempty string when successful Do not copy a FILE object
7 FIO39-C FIO40-C FIO41-C FIO42-C FIO44-C FIO45-C FIO46-C FIO47-C Do not alternately input and output from a stream without an intervening flush or positioning call Reset strings on fgets() or fgetws() failure Do not call getc(), putc(), getwc(), or putwc() with stream arguments that have side effects Close files when they are no longer needed Only use values for fsetpos() that are returned from fgetpos() Avoid TOCTOU race conditions while accessing files Do not access a closed file Use valid format strings CERT C ENV Guideline ENV01-C ENV02-C ENV03-C ENV30-C ENV31-C ENV32-C ENV33-C ENV34-C Do not make assumptions about the size of an environment variable Beware of multiple environment variables with the same effective name Sanitize the environment before external programs Do not modify the object referenced by the return value of certain functions Do not rely on an environment pointer following an operation that may invalidate it All exit handlers must return normally Do not call system() Do not store pointers returned by certain functions CERT C SIG Guideline SIG00-C SIG01-C SIG02-C SIG30-C SIG31-C SIG34-C SIG35-C Mask signals handled by noninterruptable signal handlers Understand implementation-specific details regarding signal handler persistence Avoid using signals to implement normal functionality Call only asynchronous-safe functions within signal handlers Do not access shared objects in signal handlers Do not call signal() from within interruptable signal handlers Do not return from a computational exception signal handler CERT C ERR Guideline ERR00-C ERR01-C ERR02-C ERR03-C ERR04-C ERR05-C Adopt and implement a consistent and comprehensive error handling policy Use ferror() rather than errno to check for FILE stream errors Avoid in-band error indicators Use runtime-constraint handlers when calling functions defined by TR31-1 Choose an appropriate termination strategy Application-independent code should provide error detection without dictating error handling
8 ERR06-C ERR07-C ERR30-C ERR32-C ERR33-C Understand the termination behavior of assert() and abort() Prefer functions that support error checking over equivalent functions that don't Set errno to zero before calling a library function known to set errno, and check errno only after the function returns a value indicating failure Do not rely on indeterminate values of errno Detect and handle standard library errors CERT C MSC Guideline MSC00-C MSC01-C MSC04-C MSC05-C MSC06-C MSC09-C MSC10-C MSC11-C MSC12-C MSC13-C MSC14-C MSC15-C MSC17-C MSC18-C MSC19-C MSC20-C MSC21-C MSC22-C MSC23-C MSC24-C MSC30-C MSC32-C MSC33-C MSC37-C MSC38-C MSC39-C MSC40-C Compile cleanly at high warning levels Strive for logical completeness Use comments consistently and in a readable fashion Do not manipulate time_t typed values directly Beware of compiler optimizations Character Encoding - Use Subset of ASCII for Safety Character Encoding - UTF8 Related Issues Incorporate diagnostic tests using assertions Detect and remove code that has no effect or is never executed Detect and remove unused values Do not introduce unnecessary platform dependencies Do not depend on undefined behavior Finish every set of statements associated with a case label with a break statement Be careful while handling sensitive data, such as passwords, in program code For functions that return an array, prefer returning an empty array over a null value Do not use a switch statement to transfer control into a complex block Use robust loop termination conditions Use the setjmp(), longjmp() facility securely Beware of vendor-specific library and language differences Do not use deprecated or obsolescent functions Do not use the rand function for generating pseudorandom numbers Properly seed pseudorandom number generators Do not pass invalid data to the asctime() function Ensure that control never reaches the end of a non-void function Do not treat a predefined identifier as an object if it might only be implemented as a macro Do not call va_arg() on a va_list that has an indeterminate value Do not violate constraints
9 CERT C POS Guideline POS01-C POS02-C POS04-C POS05-C POS30-C POS33-C POS34-C POS35-C POS36-C POS37-C POS38-C POS39-C POS44-C POS47-C POS48-C POS49-C POS50-C POS51-C POS52-C POS53-C POS54-C Check for the existence of links when dealing with files Follow the principle of least privilege Avoid using PTHREAD_MUTEX_NORMAL type mutex locks Limit access to files by creating a jail Use the readlink() function properly Do not use vfork() Do not call putenv() with a pointer to an automatic variable as the argument Avoid race conditions while checking for the existence of a symbolic link Observe correct revocation order while relinquishing privileges Ensure that privilege relinquishment is successful Beware of race conditions when using fork and file descriptors Use the correct byte ordering when transferring data between systems Do not use signals to terminate threads Do not use threads that can be canceled asynchronously Do not unlock or destroy another POSIX thread's mutex When data must be accessed by multiple threads, provide a mutex and guarantee no adjacent data is also accessed Declare objects shared between POSIX threads with appropriate storage durations Avoid deadlock with POSIX threads by locking in predefined order Do not perform operations that can block while holding a POSIX lock Do not use more than one mutex for concurrent waiting operations on a condition variable Detect and handle POSIX library errors Disclaimer: The information on this page was provided directly by the vendor and has not been validated by CERT.
Synopsys Static Analysis Support for SEI CERT C Coding Standard
Synopsys Static Analysis Support for SEI CERT C Coding Standard Fully ensure the safety, reliability, and security of software written in C The SEI CERT C Coding Standard is a list of rules for writing
More informationCERT-C++:2016 Standards Model Summary for C++
Version 9.7.1 Copyright 2017 Ltd. CERT-C++:2016 s Model Summary for C++ The tool suite is developed and certified to BS EN ISO 9001:2000 and SGS-TÜV Saar. This information is applicable to version 9.7.1
More informationStatic Code Analysis - CERT C Secure Code Checking
Static Code Analysis - CERT C Secure Code Checking Frozen Content Modified by on 6-Nov-2013 Related Videos CERT Code Checking The high-level C code written for an embedded software project can sometimes
More informationC Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:
C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should
More informationMotor Industry Software Reliability Association (MISRA) C:2012 Standard Mapping of MISRA C:2012 items to Goanna checks
Goanna 3.3.2 Standards Data Sheet for MISRA C:2012 misrac2012-datasheet.pdf Motor Industry Software Reliability Association (MISRA) C:2012 Standard Mapping of MISRA C:2012 items to Goanna checks The following
More informationReview of the C Programming Language for Principles of Operating Systems
Review of the C Programming Language for Principles of Operating Systems Prof. James L. Frankel Harvard University Version of 7:26 PM 4-Sep-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights
More informationCODE TIME TECHNOLOGIES. Abassi RTOS MISRA-C:2004. Compliance Report
CODE TIME TECHNOLOGIES Abassi RTOS MISRA-C:2004 Compliance Report Copyright Information This document is copyright Code Time Technologies Inc. 2012. All rights reserved. No part of this document may be
More informationReview of the C Programming Language
Review of the C Programming Language Prof. James L. Frankel Harvard University Version of 11:55 AM 22-Apr-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Reference Manual for the
More informationAxivion Bauhaus Suite Technical Factsheet MISRA
MISRA Contents 1. C... 2 1. Misra C 2004... 2 2. Misra C 2012 (including Amendment 1). 10 3. Misra C 2012 Directives... 18 2. C++... 19 4. Misra C++ 2008... 19 1 / 31 1. C 1. Misra C 2004 MISRA Rule Severity
More informationAxivion Bauhaus Suite Technical Factsheet AUTOSAR
Version 6.9.1 upwards Axivion Bauhaus Suite Technical Factsheet AUTOSAR Version 6.9.1 upwards Contents 1. C++... 2 1. Autosar C++14 Guidelines (AUTOSAR 17.03)... 2 2. Autosar C++14 Guidelines (AUTOSAR
More informationXC Specification. 1 Lexical Conventions. 1.1 Tokens. The specification given in this document describes version 1.0 of XC.
XC Specification IN THIS DOCUMENT Lexical Conventions Syntax Notation Meaning of Identifiers Objects and Lvalues Conversions Expressions Declarations Statements External Declarations Scope and Linkage
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 informationMISRA-C:2012 Standards Model Summary for C / C++
Version 9.7.1 Copyright 2017 Ltd. MISRA-C:2012 s Model Summary for C / C++ The tool suite is developed and certified to BS EN ISO 9001:2000 and SGS-TÜV Saar. This information is applicable to version 9.7.1
More informationSOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE
Software Quality Objectives Page 1/21 Version 2.0 SOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE The MathWorks 2 rue de Paris 92196 Meudon France 01 41 14 87 00 http://www.mathworks.fr Revision table Index
More informationWriting an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and
Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and #include The Use of printf() and scanf() The Use of printf()
More informationCSCI 171 Chapter Outlines
Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures
More informationEDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION
EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationThe SPL Programming Language Reference Manual
The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming
More informationContents of Lecture 3
Contents of Lecture 3 Repetition of matrices double a[3][4]; double* b; double** c; Terminology Linkage Types Conversions Jonas Skeppstedt (js@cs.lth.se) Lecture 3 2014 1 / 33 A global matrix: double a[3][4]
More informationModel Viva Questions for Programming in C lab
Model Viva Questions for Programming in C lab Title of the Practical: Assignment to prepare general algorithms and flow chart. Q1: What is a flowchart? A1: A flowchart is a diagram that shows a continuous
More informationSystems Programming. 08. Standard I/O Library. Alexander Holupirek
Systems Programming 08. Standard I/O Library Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of Konstanz Summer Term 2008 Last lecture:
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationCSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files
CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs
More informationCSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.
CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs
More information1 Lexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More informationFundamental of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering
More informationProgramming Languages Third Edition. Chapter 9 Control I Expressions and Statements
Programming Languages Third Edition Chapter 9 Control I Expressions and Statements Objectives Understand expressions Understand conditional statements and guards Understand loops and variation on WHILE
More informationC Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS
C Programming C SYLLABUS COVERAGE Introduction to Programming Fundamentals in C Operators and Expressions Data types Input-Output Library Functions Control statements Function Storage class Pointer Pointer
More informationby Pearson Education, Inc. All Rights Reserved.
Let s improve the bubble sort program of Fig. 6.15 to use two functions bubblesort and swap. Function bubblesort sorts the array. It calls function swap (line 51) to exchange the array elements array[j]
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting
More informationAppendix G C/C++ Notes. C/C++ Coding Style Guidelines Ray Mitchell 475
C/C++ Notes C/C++ Coding Style Guidelines -0 Ray Mitchell C/C++ Notes 0 0 0 0 NOTE G. C/C++ Coding Style Guidelines. Introduction The C and C++ languages are free form, placing no significance on the column
More informationIAR Embedded Workbench MISRA C:2004. Reference Guide
IAR Embedded Workbench MISRA C:2004 Reference Guide COPYRIGHT NOTICE Copyright 2004 2008 IAR Systems. All rights reserved. No part of this document may be reproduced without the prior written consent of
More informationChapter 2. Procedural Programming
Chapter 2 Procedural Programming 2: Preview Basic concepts that are similar in both Java and C++, including: standard data types control structures I/O functions Dynamic memory management, and some basic
More informationLanguage Reference Manual simplicity
Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna
More informationCSC209 Review. Yeah! We made it!
CSC209 Review Yeah! We made it! 1 CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files 2 ... and C programming... C basic syntax functions
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a
More informationIMPORTANT QUESTIONS IN C FOR THE INTERVIEW
IMPORTANT QUESTIONS IN C FOR THE INTERVIEW 1. What is a header file? Header file is a simple text file which contains prototypes of all in-built functions, predefined variables and symbolic constants.
More informationContents. Preface. Introduction. Introduction to C Programming
c11fptoc.fm Page vii Saturday, March 23, 2013 4:15 PM Preface xv 1 Introduction 1 1.1 1.2 1.3 1.4 1.5 Introduction The C Programming Language C Standard Library C++ and Other C-Based Languages Typical
More informationPage 1. Stuff. Last Time. Today. Safety-Critical Systems MISRA-C. Terminology. Interrupts Inline assembly Intrinsics
Stuff Last Time Homework due next week Lab due two weeks from today Questions? Interrupts Inline assembly Intrinsics Today Safety-Critical Systems MISRA-C Subset of C language for critical systems System
More informationChapter 12 Variables and Operators
Chapter 12 Variables and Operators Highlights (1) r. height width operator area = 3.14 * r *r + width * height literal/constant variable expression (assignment) statement 12-2 Highlights (2) r. height
More informationA Fast Review of C Essentials Part I
A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types
More informationChapter 1 INTRODUCTION. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 INTRODUCTION SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Facilities and features of PL/1. Structure of programs written in PL/1. Data types. Storage classes, control,
More informationCprE 288 Introduction to Embedded Systems Exam 1 Review. 1
CprE 288 Introduction to Embedded Systems Exam 1 Review http://class.ece.iastate.edu/cpre288 1 Overview of Today s Lecture Announcements Exam 1 Review http://class.ece.iastate.edu/cpre288 2 Announcements
More informationAbout Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals
More informationThe Waite Group's. New. Primer Plus. Second Edition. Mitchell Waite and Stephen Prata SAMS
The Waite Group's New Primer Plus Second Edition Mitchell Waite and Stephen Prata SAMS PUBLISHING A Division of Prentice Hall Computer Publishing 11711 North College, Carmel, Indiana 46032 USA Contents
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationCPSC 3740 Programming Languages University of Lethbridge. Data Types
Data Types A data type defines a collection of data values and a set of predefined operations on those values Some languages allow user to define additional types Useful for error detection through type
More informationFundamentals of Programming
Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationObjectives. In this chapter, you will:
Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about
More informationA complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.
1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object
More informationC Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee
C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,
More informationIndex. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309
A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48
More informationLESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:
LESSON 1 FUNDAMENTALS OF C The purpose of this lesson is to explain the fundamental elements of the C programming language. C like other languages has all alphabet and rules for putting together words
More informationAmsterdam Compiler Kit-ANSI C compiler compliance statements
Amsterdam Compiler Kit-ANSI C compiler compliance statements Hans van Eck Dept. of Mathematics and Computer Science Vrije Universiteit Amsterdam, The Netherlands This document specifies the implementation-defined
More informationProgramming languages - C
INTERNATIONAL STANDARD ISO/IEC 9899:1990 TECHNICAL CORRIGENDUM 1 Published 1994-09-15 Corrected and reprinted 1995-09-I 5 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION*ME~~YHAPO~HAfl OPTAHM3ALWlfl I-IO
More informationThe PCAT Programming Language Reference Manual
The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language
More informationComputer Security. Robust and secure programming in C. Marius Minea. 12 October 2017
Computer Security Robust and secure programming in C Marius Minea marius@cs.upt.ro 12 October 2017 In this lecture Write correct code minimizing risks with proper error handling avoiding security pitfalls
More information9/5/2018. Overview. The C Programming Language. Transitioning to C from Python. Why C? Hello, world! Programming in C
Overview The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments
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 informationTokens, Expressions and Control Structures
3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type
More informationCSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1
CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines
More informationComputers Programming Course 5. Iulian Năstac
Computers Programming Course 5 Iulian Năstac Recap from previous course Classification of the programming languages High level (Ada, Pascal, Fortran, etc.) programming languages with strong abstraction
More informationLECTURE 02 INTRODUCTION TO C++
PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 02 INTRODUCTION
More informationC and C++ Secure Coding 4-day course. Syllabus
C and C++ Secure Coding 4-day course Syllabus C and C++ Secure Coding 4-Day Course Course description Secure Programming is the last line of defense against attacks targeted toward our systems. This course
More informationThe C Programming Language. (with material from Dr. Bin Ren, William & Mary Computer Science)
The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) 1 Overview Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments
More informationFull file at C How to Program, 6/e Multiple Choice Test Bank
2.1 Introduction 2.2 A Simple Program: Printing a Line of Text 2.1 Lines beginning with let the computer know that the rest of the line is a comment. (a) /* (b) ** (c) REM (d)
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationStrings Investigating Memory Allocation Pointers Fixed-Point Arithmetic. Memory Matters. Embedded Systems Interfacing.
22 September 2011 Strings Single character char ch; char ch = a ; char ch = 0x41; Array of characters char str[5]={ H, e, l, l, o }; Null-terminated string char str[ ]= Hello String Runtime Library #include
More informationC mini reference. 5 Binary numbers 12
C mini reference Contents 1 Input/Output: stdio.h 2 1.1 int printf ( const char * format,... );......................... 2 1.2 int scanf ( const char * format,... );.......................... 2 1.3 char
More informationC++ Programming Basics
C++ Programming Basics Chapter 2 and pp. 634-640 Copyright 1998-2011 Delroy A. Brinkerhoff. All Rights Reserved. CS 1410 Chapter 2 Slide 1 of 25 Program Components Function main P Every C/C++ program has
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 informationA Short Summary of Javali
A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler
More informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More informationCS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II
CS107 Handout 13 Spring 2008 April 18, 2008 Computer Architecture: Take II Example: Simple variables Handout written by Julie Zelenski and Nick Parlante A variable is a location in memory. When a variable
More information5.Coding for 64-Bit Programs
Chapter 5 5.Coding for 64-Bit Programs This chapter provides information about ways to write/update your code so that you can take advantage of the Silicon Graphics implementation of the IRIX 64-bit operating
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 informationCS 261 Fall Mike Lam, Professor. Structs and I/O
CS 261 Fall 2018 Mike Lam, Professor Structs and I/O Typedefs A typedef is a way to create a new type name Basically a synonym for another type Useful for shortening long types or providing more meaningful
More informationC Programming Language (Chapter 2 of K&R) Variables and Constants
C Programming Language (Chapter 2 of K&R) Types, Operators and Expressions Variables and Constants Basic objects manipulated by programs Declare before use: type var1, var2, int x, y, _X, x11, buffer;
More informationThe Warhol Language Reference Manual
The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming
More informationProgramming in C and C++
Programming in C and C++ Types, Variables, Expressions and Statements Neel Krishnaswami and Alan Mycroft Course Structure Basics of C: Types, variables, expressions and statements Functions, compilation
More informationCodeWarrior Development Studio for Microcontrollers V10.0 MISRA-C:2004 Compliance Exceptions for the HC(S)08, RS08 and ColdFire Libraries Reference
CodeWarrior Development Studio for Microcontrollers V10.0 MISRA-C:2004 Compliance Exceptions for the HC(S)08, RS08 and ColdFire Libraries Reference Manual Revised: May 12, 2010 Freescale, the Freescale
More informationPointers cause EVERYBODY problems at some time or another. char x[10] or char y[8][10] or char z[9][9][9] etc.
Compound Statements So far, we ve mentioned statements or expressions, often we want to perform several in an selection or repetition. In those cases we group statements with braces: i.e. statement; statement;
More informationLecture 03 Bits, Bytes and Data Types
Lecture 03 Bits, Bytes and Data Types Computer Languages A computer language is a language that is used to communicate with a machine. Like all languages, computer languages have syntax (form) and semantics
More informationOperators and Expressions
Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions
More informationStructure of this course. C and C++ Past Exam Questions. Text books
Structure of this course C and C++ 1. Types Variables Expressions & Statements Alastair R. Beresford University of Cambridge Lent Term 2008 Programming in C: types, variables, expressions & statements
More informationFunction Call Stack and Activation Records
71 Function Call Stack and Activation Records To understand how C performs function calls, we first need to consider a data structure (i.e., collection of related data items) known as a stack. Students
More informationUNIT IV-2. The I/O library functions can be classified into two broad categories:
UNIT IV-2 6.0 INTRODUCTION Reading, processing and writing of data are the three essential functions of a computer program. Most programs take some data as input and display the processed data, often known
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationProgramming in C and C++
Programming in C and C++ 1. Types Variables Expressions & Statements Dr. Anil Madhavapeddy University of Cambridge (based on previous years thanks to Alan Mycroft, Alastair Beresford and Andrew Moore)
More informationZheng-Liang Lu Java Programming 45 / 79
1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 45 / 79 Example Given a radius
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More information2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program
More informationC Language Programming
Experiment 2 C Language Programming During the infancy years of microprocessor based systems, programs were developed using assemblers and fused into the EPROMs. There used to be no mechanism to find what
More information