CERT-C++:2016 Standards Model Summary for C++

Size: px
Start display at page:

Download "CERT-C++:2016 Standards Model Summary for C++"

Transcription

1 Version 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 of the tool suite. It is correct as of 25th September Compliance is measured against "CERT C++ Secure Coding Edition" 2017 Copyright Carnegie Mellon University Further information is available at Classification Enhanced Fully Partially Not yet Not statically Enforcement Implemented Implemented Implemented Checkable Total Recommendation Total

2 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description ARR30-C ARR37-C ARR38-C Do not form or use out-of-bounds pointers or array subscripts Do not add or subtract an integer to a pointer to a non-array object Guarantee that library functions do not form invalid pointers ARR39-C Do not add or subtract a scaled integer to a pointer Avoid assuming functions are thread safe unless CON00-CPPRecommendation otherwise specified CON01-CPPRecommendation Do not use volatile as a synchronization primitive Description 45 D Pointer not checked for null before use. 47 S Array bound exceeded. 476 S Array index not unsigned. 489 S Insufficient space for operation. 64 X Array bound exceeded at call. 66 X Insufficient array space at call. 68 X Parameter indexing array too big at call. 69 X Global array bound exceeded at use. 70 X Array has insufficient space. 71 X Insufficient space for copy. 79 X Size mismatch in memcpy/memset. 567 S Pointer arithmetic is not on array. 64 X Array bound exceeded at call. 66 X Insufficient array space at call. 68 X Parameter indexing array too big at call. 69 X Global array bound exceeded at use. 70 X Array has insufficient space. 71 X Insufficient space for copy. 79 X Size mismatch in memcpy/memset. 47 S Array bound exceeded. 489 S Insufficient space for operation. 567 S Pointer arithmetic is not on array. 64 X Array bound exceeded at call. 66 X Insufficient array space at call. 68 X Parameter indexing array too big at call. 69 X Global array bound exceeded at use. 70 X Array has insufficient space. 71 X Insufficient space for copy.

3 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Description CON02-CPPRecommendation Use lock classes for mutex management CON33-C Avoid race conditions when using library functions CON37-C Do not call signal() in a multithreaded program CON40-C Do not refer to an atomic variable twice in an expression CON41-C Wrap functions that can fail spuriously in a loop CON43-C Avoid race conditions with multiple threads CON50-CPP Do not destroy a mutex while it is locked CON51-CPP Ensure actively held locks are released on exceptional conditions CON52-CPP Prevent data races when accessing bit-fields from multiple threads CON53-CPP Avoid deadlock by locking in a predefined order CON54-CPP Wrap functions that can spuriously wake up in a loop CON55-CPP Preserve thread safety and liveness when using condition variables CON56-CPP Do not speculatively lock a non-recursive mutex that is already owned by the calling thread CTR00-CPP Recommendation Understand when to prefer vectors over arrays CTR01-CPPRecommendation CTR02-CPPRecommendation Do not apply the sizeof operator to a pointer when taking the size of an array Explicitly specify array bounds, even if implicitly defined by an initializer Do not confuse the find() method with the find() CTR03-CPPRecommendation algorithm Assume responsibility for cleaning up data CTR04-CPPRecommendation referenced by a container of pointers Use explicit cv- and ref-qualifiers on auto CTR05-CPPRecommendation declarations in range-based for loops 401 S Use of sizeof on an array parameter. 577 S Sizeof argument is a pointer. 127 S Array has no bounds specified. 397 S Array initialisation has insufficient items. 404 S Array initialisation has too many items. 45 D Pointer not checked for null before use.

4 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description CTR50-CPP CTR51-CPP Use valid references, pointers, and iterators to reference elements of a container CTR52-CPP Guarantee that library functions do not form invalid iterators CTR53-CPP Use valid iterator ranges CTR54-CPP Guarantee that container indices and iterators are within the valid range Do not subtract iterators that do not refer to the same container CTR55-CPP Do not use an additive operator on an iterator if the result would overflow CTR56-CPP Do not use pointer arithmetic on polymorphic objects CTR57-CPP Provide a valid ordering predicate CTR58-CPP Predicate function objects should not be mutable DCL00-CPP Recommendation const-qualify immutable objects DCL01-CPP Recommendation Do not reuse variable names in subscopes DCL02-CPP Recommendation Use visually distinct identifiers Description 47 S Array bound exceeded. 476 S Array index not unsigned. 489 S Insufficient space for operation. 64 X Array bound exceeded at call. 66 X Insufficient array space at call. 68 X Parameter indexing array too big at call. 69 X Global array bound exceeded at use. 70 X Array has insufficient space. 71 X Insufficient space for copy. 79 X Size mismatch in memcpy/memset. 70 S Logical comparison of pointers. 87 S Use of pointer arithmetic. 437 S < > <= >= used on different object pointers. 438 S Pointer subtraction not addressing one array. 567 S Pointer arithmetic is not on array. 567 S Pointer arithmetic is not on array. 78 D Global variable should be declared const. 93 D Local variable should be declared const. 200 S Define used for numeric constant. 131 S Name reused in inner scope. 358 S Class member name reused. 67 X Identifier is typographically ambiguous.

5 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Use a static assertion to test the value of a DCL03-CPP Recommendation constant expression Do not declare more than one variable per DCL04-CPP Recommendation declaration DCL05-CPP Recommendation Use typedefs to improve code readability DCL06-CPP Recommendation Properly encode relationships in constant DCL08-CPP Recommendation definitions Declare functions that return an errno error code DCL09-CPP Recommendation with a return type of errno_t Do not overload the ampersand, comma, logical DCL10-CPP Recommendation AND or logical OR operators Preserve operator semantics when overloading DCL11-CPP Recommendation operators DCL12-CPP Recommendation Explicitly declare class template specializations DCL13-CPP Recommendation DCL14-CPP Recommendation DCL15-CPP Recommendation Use meaningful symbolic constants to represent literal values in program logic DCL07-CPP Recommendation Minimize the scope of variables and methods Declare function parameters that are pointers to values not changed by the function as const Avoid assumptions about the initialization order between translation units Declare file-scope objects or functions that do not need external linkage in an unnamed namespace DCL16-CPP Recommendation Use "L," not "l," to indicate a long value Description 579 S More than one variable per declaration. 299 S Pointer to function declared without typedef. 381 S Enum, struct or union not typedeffed. 201 S Use of numeric literal in expression. 604 S Use of numeric literal as array bound/subscript. 25 D Scope of variable could be reduced. 40 S Loop index is not declared locally. 505 S Control variable not declared in for loop. 560 S Scope of variable could be reduced. 643 S Function return type is not errno_t. 211 S Overloaded &&, or comma. 508 S Operator & overloaded. 558 S Template may lead to ill-formed program. 118 D Object changed via dereferenced pointer. 120 D Pointer param should be declared pointer to const. 582 S const object reassigned. 37 D Function has persistent local side effects. 27 D Variable should be declared static. 61 D Procedure should be declared static. 553 S Function and proto should both be static. 252 S Lower case suffix to literal number.

6 Classification Description DCL17-CPP Recommendation Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Declare function parameters that are large data structures and are not changed by the function as const references DCL19-CPP Recommendation Initialize automatic local variables on declaration DCL20-CPP Recommendation Use volatile for data that cannot be cached Overloaded postfix increment and decrement DCL21-CPP operators should return a const object Functions declared with [[noreturn]] must return DCL22-CPP Recommendation void DCL30-C Declare objects with appropriate storage durations Description 64 D Local not initialised at declaration. 319 S Constructor has insufficient initialisers. 42 D Local pointer returned in function result. 77 D Local structure returned in function result. 71 S Pointer assignment to wider scope. 565 S Assignment to wider scope. DCL39-C DCL40-C Avoid information leakage when passing a structure across a trust boundary Do not create incompatible declarations of the 17 D Identifier not unique within *** characters. same function or object 1 X Declaration types do not match across a system. DCL50-CPP Do not define a C-style variadic function 41 S Ellipsis used in procedure parameter list. 86 S Attempt to define reserved word. DCL51-CPP Do not declare or define a reserved identifier DCL52-CPP Never qualify a reference type with const or volatile 218 S Name is used in standard libraries. 219 S User name starts with underscore. 580 S Macro redefinition without using #undef. DCL53-CPP Do not write syntactically ambiguous declarations 296 S Function declared at block scope. DCL54-CPP Overload allocation and deallocation functions as a pair in the same scope DCL55-CPP Avoid information leakage when passing a class object across a trust boundary DCL56-CPP Avoid cycles during initialization of static objects 6 D Recursion in procedure calls found.

7 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ DCL57-CPP Do not let exceptions escape from destructors or deallocation functions DCL58-CPP Do not modify the standard namespaces DCL59-CPP Do not define an unnamed namespace in a header file DCL60-CPP Obey the one-definition rule Beware of multiple environment variables with the ENV00-CPPRecommendation same effective name Sanitize the environment when invoking external ENV01-CPPRecommendation programs Do not call system() if you do not need a command ENV02-CPPRecommendation processor ENV03-C Sanitize the environment when invoking external Recommendation programs ENV30-C Do not modify the object referenced by the return value of certain functions ENV31-C Do not rely on an environment pointer following an operation that may invalidate it Description 453 S Throw found in destructor. 286 S Functions defined in header file. 512 S Use of unnamed namespace. 286 S Functions defined in header file. 287 S Variable definition in header file. 588 S Use of system function. 588 S Use of system function. 588 S Use of system function. 107 D Attempt to change system call capture string. 118 S main must be int (void) or int (int,char*[]). ENV32-C All exit handlers must return normally 7 S Jump out of procedure. 122 S Use of abort, exit, etc. ENV33-C Do not call system() 588 S Use of system function. ENV34-C Do not store pointers returned by certain functions 133 D Adopt and implement a consistent and ERR00-CPPRecommendation comprehensive error-handling policy Use ferror() rather than errno to check for FILE ERR01-CPPRecommendation stream errors ERR02-CPPRecommendation Avoid in-band error indicators Use runtime-constraint handlers when calling ERR03-CPPRecommendation functions defined by TR ERR04-CPPRecommendation Choose an appropriate termination strategy Pointer from system function used after subsequent call.

8 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Application-independent code should provide error ERR05-CPPRecommendation detection without dictating error handling Understand the termination behavior of assert() ERR06-CPPRecommendation and abort() ERR07-CPPRecommendation Use exception handling rather than error codes ERR08-CPPRecommendation Prefer special-purpose types for exceptions ERR09-CPPRecommendation Throw anonymous temporaries ERR10-CPPRecommendation Check for error conditions ERR12-CPPRecommendation ERR30-C Do not allow exceptions to transmit sensitive information 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 Description 122 S Use of abort, exit, etc. 454 S Throw type is not a class type. 523 S Exception type is pointer. 454 S Throw type is not a class type. 455 S Catch is not by reference. errno neither set nor checked for errno setting 121 D function. errno not checked after being set for errno setting 122 D fn. 382 S (void) missing for discarded return value. 111 D 121 D 122 D 132 D errno checked without having been set for errno setting fn. errno neither set nor checked for errno setting function. errno not checked after being set for errno setting fn. errno checked after call to non-errno setting function. 134 D errno not checked before subsequent function call. ERR32-C Do not rely on indeterminate values of errno 45 D Pointer not checked for null before use. 80 D Potentially unused function-modified value. ERR33-C Detect and handle standard library errors 124 D Var set by std lib func return not checked before use.

9 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C D Description Global set by std lib func return not checked before use. ERR34-C Detect errors when converting a string to a number ERR50-CPP Do not abruptly terminate the program 122 S Use of abort, exit, etc. ERR51-CPP Handle all exceptions 527 S No master exception handler. ERR52-CPP Do not use setjmp() or longjmp() 43 S Use of setjmp/longjmp. ERR53-CPP Do not reference base classes or class data members in a constructor or destructor function-tryblock handler 549 S Catch in c'tor/d'tor references nonstatic member. ERR54-CPP Catch handlers should order their parameter types 541 S Catch-all is not last catch. from most derived to least derived 556 S Wrong order of catches for derived class. ERR55-CPP ERR56-CPP Honor exception specifications Guarantee exception safety 56 D Throw found with no catch in scope. 56 D Throw found with no catch in scope. 71 D No matching catch for throw in called function. 527 S No master exception handler. ERR57-CPP Do not leak resources when handling exceptions 50 D Memory not freed after last reference. ERR58-CPP Handle all exceptions thrown before main() begins executing ERR59-CPP Do not throw an exception across execution boundaries ERR60-CPP Exception objects must be nothrow copy constructible ERR61-CPP Catch exceptions by lvalue reference 455 S Catch is not by reference. ERR62-CPP Detect errors when converting a string to a number EXP00-CPP Recommendation Use parentheses for precedence of operation EXP01-CPP Recommendation Do not take the size of a pointer to determine the size of the pointed-to type Be aware of the short-circuit behavior of the logical 49 S Logical conjunctions need brackets. 361 S Expression needs brackets. 577 S Sizeof argument is a pointer. 35 D Expression has side effects. 1 Q Call has execution order dependant side effects.

10 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Be aware of the short-circuit behavior of the logical EXP02-CPP Recommendation AND and OR operators Do not assume the size of a class or struct is the EXP03-CPP Recommendation sum of the sizes of its members EXP05-CPP Recommendation Do not use C-style casts Do not diminish the benefits of constants by EXP07-CPP Recommendation assuming their values in expressions EXP08-CPP Recommendation Ensure pointer arithmetic is used correctly Use sizeof to determine the size of a type or EXP09-CPP Recommendation variable Do not apply operators expecting one type to data EXP11-CPP Recommendation of an incompatible type Do not ignore values returned by functions or EXP12-CPP Recommendation methods Prefer dynamic_cast over static_cast over EXP13-CPP Recommendation reinterpret_cast Do not use reinterpret_cast on pointers to class EXP14-CPP Recommendation objects with multiple inheritence Beware of integer promotion when performing EXP15-CPP Recommendation bitwise operations on chars or shorts EXP16-CPP Recommendation Avoid conversions using void pointers Treat relational and equality operators as if they EXP17-CPP Recommendation were nonassociative EXP18-CPP Recommendation Prefer the prefix forms of ++ and -- Do not perform assignments in conditional EXP19-CPP Recommendation expressions Description 133 S Assignment operator in RHS of && or. 406 S Use of ++ or -- on RHS of && or operator. 408 S Volatile variable accessed on RHS of && or. 578 S Sizeof used in arithmetic expression. 638 S Memory allocation non-conformant with type. 306 S Use of C type cast. 201 S Use of numeric literal in expression. 45 D Pointer not checked for null before use. 53 D Attempt to use uninitialised pointer. 54 D Unsafe use of function pointer variable. 87 S Use of pointer arithmetic. 438 S Pointer subtraction not addressing one array. 576 S Function pointer is of wrong type. 201 S Use of numeric literal in expression. 554 S Cast to an unrelated type. 382 S (void) missing for discarded return value. 241 S Use of reinterpret_cast. 241 S Use of reinterpret_cast. 334 S No cast when ~ or << applied to small types (MR). 540 S Cast from pointer to void to pointer. 96 S Use of mixed mode arithmetic. 433 S Type conversion without cast. 30 S Deprecated usage of ++ or -- operators found. 132 S Assignment operator in boolean expression.

11 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ EXP34-C Do not dereference null pointers EXP35-C Do not modify objects with temporary lifetime EXP36-C EXP37-C Description 45 D Pointer not checked for null before use. 123 D File pointer not checked for null before use. 128 D Global pointer not checked within this procedure. Global file pointer not checked within this 129 D procedure. 135 D Pointer assigned to NULL may be dereferenced. Global pointer assigned to NULL may be 136 D dereferenced. Parameter used as denominator not checked 137 D before use. 652 S Object created by malloc used before initialisation. 42 D Local pointer returned in function result. 77 D Local structure returned in function result. 642 S Function return type with array field. 94 S Casting operation on a pointer. 540 S Cast from pointer to void to pointer. 606 S Cast involving function pointer. 41 D Procedure call has no prototype declared. 458 S Implicit conversion: actual to formal param (MR). 576 S Function pointer is of wrong type. 94 S Casting operation on a pointer. 554 S Cast to an unrelated type. EXP39-C Do not access a variable through a pointer of an incompatible type EXP42-C Do not compare padding data 618 S Use of memcmp between structures. EXP45-C Do not perform assignments in selection 114 S Expression is not Boolean. statements 132 S Assignment operator in boolean expression. EXP46-C Do not use a bitwise operator with a Boolean-like operand 136 S Bit operator with boolean operand. EXP47-C Do not call va_arg with an argument of the incorrect type EXP50-CPP Do not cast pointers into more strictly aligned pointer types Call functions with the correct number and type of arguments Do not depend on the order of evaluation for side 35 D Expression has side effects. 67 D Void function has global variable side effects. 72 D Potential side effect problem in expression.

12 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description EXP50-CPP effects EXP51-CPP Do not delete an array through a pointer of the incorrect type EXP52-CPP Do not rely on side effects in unevaluated operands EXP53-CPP Do not read uninitialized memory EXP54-CPP Do not access an object outside of its lifetime EXP55-CPP Do not access a cv-qualified object through a cvunqualified type EXP56-CPP Do not call a function with a mismatched language linkage EXP57-CPP Do not cast or delete pointers to incomplete classes EXP58-CPP Pass an object of the correct type to va_start EXP59-CPP Use offsetof() on valid types and members EXP60-CPP Do not pass a nonstandard-layout type object across execution boundaries EXP61-CPP A lambda object must not outlive any of its reference captured objects Description 1 Q Call has execution order dependant side effects. 9 S Assignment operation in expression. 134 S Volatile variable in complex expression. 54 S Sizeof operator with side effects. 133 S Assignment operator in RHS of && or. 53 D Attempt to use uninitialised pointer. 69 D UR anomaly, variable used before assignment. 631 S Declaration not reachable. 652 S Object created by malloc used before initialisation. 42 D Local pointer returned in function result. 53 D Attempt to use uninitialised pointer. 77 D Local structure returned in function result. 1 J Unreachable Code found. 71 S Pointer assignment to wider scope. 565 S Assignment to wider scope. 203 S Cast on a constant value. 242 S Use of const_cast. 344 S Cast on volatile value. 169 S Use of forward reference of class member. 554 S Cast to an unrelated type.

13 Classification Description EXP62-CPP Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Do not access the bits of an object representation that are not part of the object's value representation EXP63-CPP Do not rely on the value of a moved-from object FIO00-CPP Recommendation Take care when creating format strings Be careful using functions that use file names for FIO01-CPP Recommendation identification Canonicalize path names originating from FIO02-CPP Recommendation untrusted sources Do not make assumptions about fopen() and file FIO03-CPP Recommendation creation FIO04-CPP Recommendation Detect and handle input and output errors FIO05-CPP Recommendation Identify files using multiple file attributes FIO06-CPP Recommendation Create files with appropriate access permissions FIO07-CPP Recommendation Prefer fseek() to rewind() FIO08-CPP Recommendation Take care when calling remove() on an open file Be careful with binary data when transferring data FIO09-CPP Recommendation across systems FIO10-CPP Recommendation Take care when using the rename() function Take care when specifying the mode parameter of FIO11-CPP Recommendation fopen() FIO12-CPP Recommendation Prefer setvbuf() to setbuf() Never push back anything other than one read FIO13-CPP Recommendation character Understand the difference between text mode and FIO14-CPP Recommendation binary mode with file streams Ensure that file operations are performed in a FIO15-CPP Recommendation secure directory FIO17-CPP Recommendation Prefer streams to C-style input and output Description 618 S Use of memcmp between structures. 486 S Incorrect number of formats in output function. 589 S Format is not appropriate type. 592 S Use of filename based functions. 85 D Filename not verified before fopen. 80 D Potentially unused function-modified value. 382 S (void) missing for discarded return value. 593 S Use fseek() rather than rewind(). 81 D Attempt to remove an open file. 592 S Use of filename based functions. 590 S Mode fault in fopen. 594 S Use setvbuf() rather than setbuf(). 83 D Potentially repeated call to ungetc. 130 S Included file is not permitted.

14 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Description Never expect write() to terminate the writing FIO18-CPP Recommendation process at a null character FIO19-CPP Recommendation Do not create temporary files in shared directories Do not rely on an ending null character when using FIO20-CPP Recommendation read() Do not simultaneously open the same file multiple FIO21-CPP Recommendation times 75 D Attempt to open file pointer more than once. FIO30-C Exclude user input from format strings 86 D User input not checked before use. FIO32-C Do not perform operations on devices that are only appropriate for files FIO34-C Distinguish between characters read from a file and 433 S Type conversion without cast. EOF or WEOF 662 S EOF compared with char. FIO37-C Do not assume that fgets() or fgetws() returns a nonempty string when successful FIO38-C Do not copy a FILE object 591 S Inappropriate use of file pointer. FIO39-C Do not alternately input and output from a stream without an intervening flush or positioning call 84 D No fseek or flush before I/O. FIO40-C Reset strings on fgets() or fgetws() failure 35 D Expression has side effects. FIO41-C Do not call getc(), putc(), getwc(), or putwc() with a stream argument that has side effects 1 Q Call has execution order dependant side effects. 9 S Assignment operation in expression. 30 S Deprecated usage of ++ or -- operators found. 134 S Volatile variable in complex expression. FIO42-C Close files when they are no longer needed 49 D File pointer not closed on exit. FIO44-C Only use values for fsetpos() that are returned from fgetpos() 82 D fsetpos values not generated by fgetpos. FIO45-C Avoid TOCTOU race conditions while accessing files 75 D Attempt to open file pointer more than once. FIO46-C FIO47-C Do not access a closed file Use valid format strings 48 D Attempt to write to unopened file. 486 S Incorrect number of formats in output function. 589 S Format is not appropriate type.

15 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ FIO50-CPP Do not alternately input and output from a file stream without an intervening positioning call FIO51-CPP Close files when they are no longer needed Understand the limitations of floating-point FLP00-CPP Recommendation numbers FLP01-CPP Recommendation Take care in rearranging floating-point expressions FLP02-CPP Recommendation Avoid using floating-point numbers when precise computation is needed FLP03-CPP Recommendation Detect and handle floating point errors FLP04-CPP Recommendation Check floating point inputs for exceptional values Convert integers to floating point for floating point FLP05-CPP Recommendation operations Description 56 S Equality comparison of floating point. 43 D Divide by zero found. 433 S Type conversion without cast. 445 S Narrower float conversion without cast. No cast for widening complex float expression 451 S (MR). 435 S Float/integer conversion without cast. FLP30-C Do not use floating point variables as loop counters 39 S Unsuitable type for loop variable. FLP32-C FLP34-C Prevent or detect domain and range errors in math functions Ensure that floating-point conversions are within range of the new type FLP36-C Preserve precision when converting integral values to floating-point type FLP37-C Do not use object representations to compare floating-point values Understand the data model used by your INT00-CPP Recommendation implementation(s) Use rsize_t or size_t for all integer values INT01-CPP Recommendation representing the size of an object 93 S Value is not of appropriate type. 435 S Float/integer conversion without cast. 445 S Narrower float conversion without cast. 435 S Float/integer conversion without cast. 618 S Use of memcmp between structures. 458 S Implicit conversion: actual to formal param (MR).

16 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description INT02-CPP Recommendation Understand integer conversion rules INT03-CPP Recommendation Use a secure integer library Enforce limits on integer values originating from INT04-CPP Recommendation untrusted sources Do not use input functions to convert character INT05-CPP Recommendation data if they cannot handle all possible inputs Use strtol() or a related function to convert a string INT06-CPP Recommendation token to an integer INT07-CPP Recommendation INT08-CPP Recommendation Verify that all integer values are in range INT09-CPP Recommendation Use only explicitly signed or unsigned char type for numeric values Ensure enumeration constants map to unique values Description 52 S Unsigned expression negated. 93 S Value is not of appropriate type. 96 S Use of mixed mode arithmetic. 101 S Function return type inconsistent. 107 S Type mismatch in ternary expression. Widening cast on complex integer expression 332 S (MR). 334 S No cast when ~ or << applied to small types (MR). 433 S Type conversion without cast. 434 S Signed/unsigned conversion without cast. 446 S Narrower int conversion without cast. 452 S No cast for widening complex int expression (MR). 457 S Implicit int widening for function return (MR). 458 S Implicit conversion: actual to formal param (MR). 93 S Value is not of appropriate type. 96 S Use of mixed mode arithmetic. 101 S Function return type inconsistent. 329 S Operation not appropriate to plain char. 432 S Inappropriate type - should be plain char. 458 S Implicit conversion: actual to formal param (MR). 488 S Value outside range of underlying type. 493 S Numeric overflow. 494 S Numeric underflow. 85 S Incomplete initialisation of enumerator. 630 S Duplicated enumeration value.

17 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Do not assume a positive remainder when using INT10-CPP Recommendation the % operator Take care when converting from pointer to integer INT11-CPP Recommendation or integer to pointer Do not make assumptions about the type of a plain INT12-CPP Recommendation int bit-field when used in an expression INT13-CPP Recommendation Use bitwise operators only on unsigned operands Avoid performing bitwise and arithmetic operations INT14-CPP Recommendation on the same data Use intmax_t or uintmax_t for formatted IO on INT15-CPP Recommendation programmer-defined integer types Do not make assumptions about representation of INT16-CPP Recommendation signed integers Define integer constants in an implementationindependent manner INT17-CPP Recommendation Evaluate integer expressions in a larger size before INT18-CPP Recommendation comparing or assigning to that size Ensure that unsigned integer operations do not INT30-C wrap INT31-C INT32-C INT33-C Ensure that integer conversions do not result in lost or misinterpreted data Ensure that operations on signed integers do not result in overflow Ensure that division and remainder operations do not result in divide-by-zero errors Description 584 S Remainder of % op could be negative. 439 S Cast from pointer to integral type. 440 S Cast from integral type to pointer. 520 S Bit field is not bool or explicit integral. 50 S Use of shift operator on signed type. 120 S Use of bit operator on signed type. 136 S Bit operator with boolean operand. 331 S Literal value requires a U suffix. 50 S Use of shift operator on signed type. 120 S Use of bit operator on signed type. 452 S No cast for widening complex int expression (MR). 493 S Numeric overflow. 494 S Numeric underflow. 93 S Value is not of appropriate type. 433 S Type conversion without cast. 434 S Signed/unsigned conversion without cast. 493 S Numeric overflow. 494 S Numeric underflow. 43 D Divide by zero found. Local or member denominator not checked before 127 D use. Global denominator not checked within this 131 D procedure.

18 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Do not shift an expression by a negative number of INT34-C bits or by greater than or equal to the number of bits that exist in the operand INT35-C Use correct integer precisions INT36-C Converting a pointer to integer or integer to pointer INT50-CPP Do not cast to an out-of-range enumeration value Overloaded new operators should check that their MEM00-CPPRecommendation size argument matches the size of their class Store a valid value in pointers immediately after MEM01-CPPRecommendation deallocation Immediately cast the result of a memory allocation MEM02-CPPRecommendation function call into a pointer to the allocated type Clear sensitive information stored in returned MEM03-CPPRecommendation reusable resources MEM04-CPPRecommendation Do not perform zero-length allocations MEM05-CPPRecommendation Avoid large stack allocations MEM06-CPPRecommendation Ensure that sensitive data is not written out to disk Ensure that the arguments to calloc(), when MEM07-CPPRecommendation multiplied, can be represented as a size_t Use new and delete rather than raw memory MEM08-CPPRecommendation allocation and deallocation Do not assume memory allocation routines initialize MEM09-CPPRecommendation memory Description 248 S Divide by zero in preprocessor directive. 629 S Divide by zero found. 80 X Divide by zero found. 51 S Shifting value too far. 403 S Negative (or potentially negative) shift. 479 S Right shift loses all bits. 439 S Cast from pointer to integral type. 440 S Cast from integral type to pointer. 112 D Free called twice on same variable. 484 S Attempt to use already freed object. 5 C Procedure contains infinite loop. 6 D Recursion in procedure calls found. 28 D Potentially infinite loop found. 26 S Loop control expression may not terminate loop. 140 S Infeasible loop condition found. 1 U Inter-file recursion found. 652 S Object created by malloc used before initialisation.

19 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description MEM10-CPPRecommendation Define and use a pointer validation function Allocate and free memory in the same module, at MEM11-CPPRecommendation the same level of abstraction MEM12-CPPRecommendation Do not assume infinite heap space MEM13-CPPRecommendation Use smart pointers instead of raw pointers for resource management MEM30-C Do not access freed memory MEM31-C Free dynamically allocated memory when no longer needed MEM34-C Only free memory allocated dynamically MEM35-C Allocate sufficient memory for an object MEM36-C Do not modify the alignment of objects by calling realloc() MEM50-CPP Do not access freed memory Description 159 S Comparing pointer with zero or NULL. 50 D Memory not freed after last reference. 5 C Procedure contains infinite loop. 6 D Recursion in procedure calls found. 28 D Potentially infinite loop found. 26 S Loop control expression may not terminate loop. 140 S Infeasible loop condition found. 1 U Inter-file recursion found. 51 D Attempt to read from freed memory. 112 D Free called twice on same variable. 484 S Attempt to use already freed object. 50 D Memory not freed after last reference. 125 D free called on variable with no allocated space. 407 S free used on string. 483 S Freed parameter is not heap item. 644 S realloc ptr does not originate from allocation function. 645 S realloc ptr type does not match target type. 115 D Copy length parameter not checked before use. 400 S Use of sizeof on a type. 487 S Insufficient space allocated. 644 S realloc ptr does not originate from allocation function. 483 S Freed parameter is not heap item. 484 S Attempt to use already freed object. 64 D Local not initialised at declaration. 112 D Free called twice on same variable. 232 S No destructor defined for class.

20 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Description 236 S New used in class without assignment op. MEM51-CPP 239 S New used in class without copy constructor. Properly deallocate dynamically allocated 407 S free used on string. resources 469 S No copy constructor for complex destructor. 470 S No assignment operator for complex destrtor. 483 S Freed parameter is not heap item. 484 S Attempt to use already freed object. 485 S Array deletion without []. MEM52-CPP Detect and handle memory allocation errors 45 D Pointer not checked for null before use. MEM53-CPP Explicitly construct and destruct objects when manually managing object lifetime MEM54-CPP Provide placement new with properly aligned pointers to sufficient storage capacity 597 S Use of placement new. MEM55-CPP Honor replacement dynamic storage management requirements MEM56-CPP Do not store an already-owned pointer value in an unrelated smart pointer MEM57-CPP Avoid using default operator new for over-aligned types MSC00-CPPRecommendation Compile cleanly at high warning levels MSC01-CPPRecommendation Strive for logical completeness 48 S No default case in switch statement. 59 S Else alternative missing in if. MSC02-CPPRecommendation Avoid errors of omission 99 S Function use is not a call. 132 S Assignment operator in boolean expression. 5 S Empty then clause. MSC03-CPPRecommendation Avoid errors of addition 57 S Statement with no side effect. 58 S Null statement found. 59 S Else alternative missing in if. 119 S Nested comment found. Use comments consistently and in a readable MSC04-CPPRecommendation 302 S Comment possibly contains code. fashion 611 S Line splice used in // comment. 96 S Use of mixed mode arithmetic.

21 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description MSC05-CPPRecommendation Do not manipulate time_t typed values directly MSC06-CPPRecommendation Be aware of compiler optimization when dealing with sensitive data MSC07-CPPRecommendation Detect and remove dead code MSC08-CPPRecommendation Functions should validate their parameters MSC09-CPPRecommendation Character encoding: Use subset of ASCII for safety MSC10-CPPRecommendation Character encoding: UTF8-relateds MSC11-CPPRecommendation Incorporate diagnostic tests using assertions MSC12-CPPRecommendation Detect and remove code that has no effect Description 101 S Function return type inconsistent. 107 S Type mismatch in ternary expression. 433 S Type conversion without cast. 458 S Implicit conversion: actual to formal param (MR). 8 D DD data flow anomalies found. 65 D Void function has no side effects. Procedure is not called or referenced in code 76 D analysed. DU anomaly dead code, var value is unused on all 105 D paths. 1 J Unreachable Code found. 3 J All internal linkage calls unreachable. Static procedure is not explicitly called in code 35 S analysed. 57 S Statement with no side effect. 8 D DD data flow anomalies found. 65 D Void function has no side effects. DU anomaly dead code, var value is unused on all 105 D paths. 1 J Unreachable Code found. 57 S Statement with no side effect. 139 S Construct leads to infeasible code. 140 S Infeasible loop condition found. 85 D Filename not verified before fopen. 86 D User input not checked before use. 86 D User input not checked before use. 113 S Non standard character in source. 176 S Non standard escape sequence in source. 65 D Void function has no side effects. DU anomaly dead code, var value is unused on all 105 D paths.

22 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description MSC13-CPPRecommendation Detect and remove unused values MSC14-CPPRecommendation Do not introduce unnecessary platform dependencies MSC15-CPPRecommendation Do not depend on undefined behavior Description 57 S Statement with no side effect. 1 D Unused procedure parameter. 8 D DD data flow anomalies found. 15 D Unused procedural parameter. 91 D Function return value potentially unused. 94 D Named variable declared but not used in code. DU anomaly dead code, var value is unused on all 105 D paths. 17 D Identifier not unique within *** characters. 42 S Use of bit field in structure declaration. 69 S #pragma used. 48 D Attempt to write to unopened file. 63 D No definition in system for prototyped procedure. 84 D No fseek or flush before I/O. 113 D File closed more than once. 5 Q File does not end with new line. 64 S Void procedure used in expression. 65 S Void variable passed as parameter. 100 S #include filename is non conformant. 109 S Array subscript is not integral. 156 S Use of 'defined' keyword in macro body. 296 S Function declared at block scope. 324 S Macro call has wrong number of parameters. 335 S Operator defined contains illegal items. 336 S #if expansion contains define operator. 339 S #include directive with illegal items. 412 S Undefined behaviour, \ before E-O-F. 427 S Filename in #include not in < > or " ". 465 S Struct/union not completely specified. 482 S Incomplete structure referenced. 497 S Type is incomplete in translation unit. 545 S Assignment of overlapping storage.

23 Classification Description Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ MSC16-CPPRecommendation Consider encrypting function pointers MSC17-CPPRecommendation Do not use deprecated or obsolescent functionality Description 587 S Const local variable not immediately initialised. 608 S Use of explicitly undefined language feature. Function prototype/defn return type mismatch 62 X (MR). Function prototype/defn param type mismatch 63 X (MR). Finish every set of statements associated with a MSC18-CPPRecommendation case label with a break statement 62 S Switch case not terminated with break. MSC19-CPPRecommendation Do not define static private members 38 S Use of static class member. Do not use a switch statement to transfer control MSC20-CPPRecommendation into a complex block 245 S Case statement in nested block. Use inequality to terminate a loop whose counter MSC21-CPPRecommendation changes by more than one 510 S Loop counter increment and operator defect. MSC30-C Do not use the rand() function for generating pseudorandom numbers MSC32-C Properly seed pseudorandom number generators MSC33-C Do not pass invalid data to the asctime() function MSC37-C MSC38-C MSC39-C 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 MSC40-C Do not violate constraints Ensure that control never reaches the end of a nonvoid function 2 D Function does not return a value on all paths. 36 S Function has no return statement. 66 S Function with empty return expression. 145 S #if has invalid expression. 323 S Switch has more than one default case. 345 S Bit operator with floating point operand. 387 S Enum init not integer-constant-expression. 404 S Array initialisation has too many items.

24 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description MSC40-C Do not violate constraints MSC50-CPP Do not use std::rand() for generating pseudorandom numbers MSC51-CPP Ensure your random number generator is properly seeded MSC52-CPP Value-returning functions must return a value from all exit paths MSC53-CPP Do not return from a function declared [[noreturn]] MSC54-CPP A signal handler must be a plain old function OOP00-CPPRecommendation Declare data members private Be careful with the definition of conversion OOP01-CPPRecommendation operators OOP02-CPPRecommendation Do not hide inherited non-virtual member functions OOP03-CPPRecommendation Prefer not to overload virtual functions Prefer not to give virtual functions default argument OOP04-CPPRecommendation initializers OOP05-CPPRecommendation Avoid deleting this Create a private copy constructor and assignment OOP06-CPPRecommendation operator for non copyable objects Do not inherit from multiple classes that have OOP07-CPPRecommendation distinct objects with the same name OOP08-CPPRecommendation Do not return references to private data Ensure that single-argument constructors are OOP09-CPPRecommendation marked "explicit" Do not assume that copy constructor invocations OOP10-CPPRecommendation will not be elided Description 481 S Array with no bounds in struct. 580 S Macro redefinition without using #undef. 612 S inline function should be declared static. 615 S Conditional operator has incompatible types. 646 S Struct initialisation has too many items. 2 D Function does not return a value on all paths. 36 S Function has no return statement. 202 S Class data is not explicitly private. 394 S Conversion function found. 262 S Non virtual function redefined. 601 S Insufficient overridden members. 359 S Default parameter use. 233 S No copy constructor for class with pointers. 234 S No assignment operator for class with pointers. 555 S Base class member name not unique. 392 S Class data accessible thru non const member. 671 S Class data accessible thru non const handle. 393 S Single parameter constructor not 'explicit'. 529 S Static member initialised/assigned in constructor.

25 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Do not copy-initialize members or base classes OOP11-CPPRecommendation from a move constructor OOP50-CPP Do not invoke virtual functions from constructors or destructors OOP51-CPP Do not slice derived objects OOP52-CPP Do not delete a polymorphic object without a virtual destructor OOP53-CPP Write constructor member initializers in the canonical order OOP54-CPP Gracefully handle self-copy assignment OOP55-CPP Do not use pointer-to-member operators to access nonexistent members OOP56-CPP Honor replacement handler requirements OOP57-CPP Prefer special member functions and overloaded operators to C Library functions OOP58-CPP Copy operations must not mutate the source object PRE00-CPP Recommendation Avoid defining macros Use parentheses within macros around parameter PRE01-CPPRecommendation names PRE02-CPP Recommendation Macro replacement lists should be parenthesized PRE03-CPP Recommendation Prefer typedefs to defines for encoding types PRE04-CPP Recommendation Do not reuse a standard header file name PRE05-CPPRecommendation Understand macro replacement when concatenating tokens or performing stringification PRE06-CPP Recommendation Enclose header files in an inclusion guard PRE07-CPP Recommendation Avoid using repeated question marks PRE08-CPP Recommendation Guarantee that header file names are unique Do not replace secure functions with less secure PRE09-CPPRecommendation functions Description 92 D C'tor/d'tor calls virtual function. 467 S Virtual member called in ctor/dtor. 303 S Virtual class members need virtual destructor. 206 S Class initialiser out of order. 79 S Macro contains unacceptable items. 340 S Use of function like macro. 78 S Macro parameter not in brackets. 77 S Macro replacement list needs parentheses. 79 S Macro contains unacceptable items. 568 S #include "filename" uses standard library name. 76 S More than one of # or ## in a macro. 125 S Use of ## or # in a macro. 637 S # operand followed by ##. 243 S Included file not protected with #define. 81 S Use of trigraph.

26 PRE30-C Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description Description 35 D Expression has side effects. 72 D Potential side effect problem in expression. PRE10-CPP Recommendation Do not define unsafe macros 1 Q Call has execution order dependant side effects. 134 S Volatile variable in complex expression. 562 S Use of ++,-- or = in macro parameters. 58 S Null statement found. PRE11-CPP Recommendation Do not conclude macro definitions with a semicolon 79 S Macro contains unacceptable items. Do not create a universal character name through concatenation PRE31-C Avoid side effects in arguments to unsafe macros 573 S Macro concatenation of uni char names. 35 D Expression has side effects. 1 Q Call has execution order dependant side effects. 9 S Assignment operation in expression. 562 S Use of ++,-- or = in macro parameters. 572 S Side effect in assert. PRE32-C Do not use preprocessor directives in invocations of function-like macros 341 S Preprocessor construct as macro parameter. Mask signals handled by noninterruptible signal SIG00-CPP Recommendation handlers 87 D Illegal shared object in signal handler. Understand implementation-specific details SIG01-CPP Recommendation regarding signal handler persistence 97 D Signal called from within signal handler. Avoid using signals to implement normal SIG02-CPP Recommendation functionality SIG31-C Do not access shared objects in signal handlers 87 D Illegal shared object in signal handler. SIG34-C Do not call signal() from within interruptible signal handlers 97 D Signal called from within signal handler. SIG35-C Do not return from a computational exception signal handler STR00-CPP Recommendation Represent characters using an appropriate type STR01-CPP Recommendation Adopt and implement a consistent plan for managing strings 329 S Operation not appropriate to plain char. 432 S Inappropriate type - should be plain char. 108 D Tainted argument to unprototyped func ptr.

27 Version Copyright 2017 Ltd. CERT-C++:2016 s Model Compliance for C++ Classification Description STR02-CPP Recommendation Sanitize data passed to complex subsystems STR03-CPP Recommendation STR04-CPP Recommendation Use pointers to const when referring to string STR05-CPP Recommendation literals Do not assume that strtok() leaves the parse string STR06-CPP Recommendation unchanged Don't assume numeric values for expressions with STR07-CPP Recommendation type plain character Do not specify the bound of a character array STR08-CPP initialized with a string literal STR31-C STR32-C STR34-C STR37-C STR38-C Do not inadvertently truncate a null-terminated character array Use plain char for characters in the basic character set STR30-C 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 char 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 Description 109 D Tainted argument to formatted i/o function. 588 S Use of system function. 115 S String incorrectly terminated. 93 S Value is not of appropriate type. 101 S Function return type inconsistent. 329 S Operation not appropriate to plain char. 432 S Inappropriate type - should be plain char. 458 S Implicit conversion: actual to formal param (MR). 623 S String assigned to non const object. 602 S strtok may change the parse string. 329 S Operation not appropriate to plain char. 404 S Array initialisation has too many items. 157 S Modification of string literal. 623 S String assigned to non const object. 109 D Tainted argument to formatted i/o function. 489 S Insufficient space for operation. 66 X Insufficient array space at call. 70 X Array has insufficient space. 71 X Insufficient space for copy. 404 S Array initialisation has too many items. 600 S Argument of strlen is unterminated. 433 S Type conversion without cast. 663 S Invalid value may be passed to function in <ctype.h>.

CERT C Rules implemented in the LDRA tool suite

CERT C Rules implemented in the LDRA tool suite 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 9.5.1 of the LDRA tool suite. Guidelines

More information

MISRA-C:2012 Standards Model Summary for C / C++

MISRA-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 information

Synopsys Static Analysis Support for SEI CERT C Coding Standard

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 information

Axivion Bauhaus Suite Technical Factsheet MISRA

Axivion 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 information

Motor Industry Software Reliability Association (MISRA) C:2012 Standard Mapping of MISRA C:2012 items to Goanna checks

Motor 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 information

Axivion Bauhaus Suite Technical Factsheet AUTOSAR

Axivion 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 information

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

C 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 information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things.

Appendix. Grammar. A.1 Introduction. A.2 Keywords. There is no worse danger for a teacher than to teach words instead of things. A Appendix Grammar There is no worse danger for a teacher than to teach words instead of things. Marc Block Introduction keywords lexical conventions programs expressions statements declarations declarators

More information

CODE TIME TECHNOLOGIES. Abassi RTOS MISRA-C:2004. Compliance Report

CODE 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 information

Review of the C Programming Language

Review 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 information

Review of the C Programming Language for Principles of Operating Systems

Review 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 information

Short Notes of CS201

Short 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 information

CS201 - Introduction to Programming Glossary By

CS201 - 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 information

Problem Solving with C++

Problem Solving with C++ GLOBAL EDITION Problem Solving with C++ NINTH EDITION Walter Savitch Kendrick Mock Ninth Edition PROBLEM SOLVING with C++ Problem Solving with C++, Global Edition Cover Title Copyright Contents Chapter

More information

Tokens, Expressions and Control Structures

Tokens, 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 information

XC Specification. 1 Lexical Conventions. 1.1 Tokens. The specification given in this document describes version 1.0 of XC.

XC 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 information

Writing 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 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 information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

MULTI: C and C++ Compiler Error Messages

MULTI: C and C++ Compiler Error Messages MULTI: C and C++ Compiler Error Messages Green Hills Software, Inc. 30 West Sola Street Santa Barbara, California 93101 USA Tel: 805-965-6044 Fax: 805-965-6343 www.ghs.com DISCLAIMER GREEN HILLS SOFTWARE,

More information

Static Code Analysis - CERT C Secure Code Checking

Static 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 information

Interview Questions of C++

Interview Questions of C++ Interview Questions of C++ Q-1 What is the full form of OOPS? Ans: Object Oriented Programming System. Q-2 What is a class? Ans: Class is a blue print which reflects the entities attributes and actions.

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.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 information

Model Viva Questions for Programming in C lab

Model 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 information

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

About 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 information

C++ Coding Standards. 101 Rules, Guidelines, and Best Practices. Herb Sutter Andrei Alexandrescu. Boston. 'Y.'YAddison-Wesley

C++ Coding Standards. 101 Rules, Guidelines, and Best Practices. Herb Sutter Andrei Alexandrescu. Boston. 'Y.'YAddison-Wesley C++ Coding Standards 101 Rules, Guidelines, and Best Practices Herb Sutter Andrei Alexandrescu 'Y.'YAddison-Wesley Boston Contents Prefaee xi Organizational and Poliey Issues 1 o. Don't sweat the small

More information

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix PGJC4_JSE8_OCA.book Page ix Monday, June 20, 2016 2:31 PM Contents Figures Tables Examples Foreword Preface xix xxi xxiii xxvii xxix 1 Basics of Java Programming 1 1.1 Introduction 2 1.2 Classes 2 Declaring

More information

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and

More information

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p.

Welcome to Teach Yourself Acknowledgments Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p. Welcome to Teach Yourself p. viii Acknowledgments p. xv Fundamental C++ Programming p. 2 An Introduction to C++ p. 4 A Brief History of C++ p. 6 Standard C++: A Programming Language and a Library p. 8

More information

Basic Types, Variables, Literals, Constants

Basic Types, Variables, Literals, Constants Basic Types, Variables, Literals, Constants What is in a Word? A byte is the basic addressable unit of memory in RAM Typically it is 8 bits (octet) But some machines had 7, or 9, or... A word is the basic

More information

The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured

The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured Introduction p. xxix The Foundation of C++: The C Subset An Overview of C p. 3 The Origins and History of C p. 4 C Is a Middle-Level Language p. 5 C Is a Structured Language p. 6 C Is a Programmer's Language

More information

IAR Embedded Workbench MISRA C:2004. Reference Guide

IAR 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 information

UNIT- 3 Introduction to C++

UNIT- 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 information

IMPORTANT QUESTIONS IN C FOR THE INTERVIEW

IMPORTANT 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 information

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object CHAPTER 1 Introduction to Computers and Programming 1 1.1 Why Program? 1 1.2 Computer Systems: Hardware and Software 2 1.3 Programs and Programming Languages 8 1.4 What is a Program Made of? 14 1.5 Input,

More information

Contents. Preface. Introduction. Introduction to C Programming

Contents. 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 information

The PCAT Programming Language Reference Manual

The 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 information

CS201 Some Important Definitions

CS201 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 information

Operators and Expressions

Operators 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 information

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p.

Preface to the Second Edition Preface to the First Edition Brief Contents Introduction to C++ p. 1 A Review of Structures p. Preface to the Second Edition p. iii Preface to the First Edition p. vi Brief Contents p. ix Introduction to C++ p. 1 A Review of Structures p. 1 The Need for Structures p. 1 Creating a New Data Type Using

More information

Practical C++ Programming

Practical C++ Programming SECOND EDITION Practical C++ Programming Steve Oualline O'REILLY' Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo Preface xv Part I. The Basics 1. What Is C++? 3 A Brief History of C++ 3 C++

More information

Chapter 2. Procedural Programming

Chapter 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 information

Borland 105, 278, 361, 1135 Bounded array Branch instruction 7 break statement 170 BTree 873 Building a project 117 Built in data types 126

Borland 105, 278, 361, 1135 Bounded array Branch instruction 7 break statement 170 BTree 873 Building a project 117 Built in data types 126 INDEX = (assignment operator) 130, 816 = 0 (as function definition) 827 == (equality test operator) 146! (logical NOT operator) 159!= (inequality test operator) 146 #define 140, 158 #include 100, 112,

More information

Java Primer 1: Types, Classes and Operators

Java 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 information

SOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE

SOFTWARE 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 information

1 Lexical Considerations

1 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 information

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University) Estd: 1994 JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli - 621014 (An approved by AICTE and Affiliated to Anna University) ISO 9001:2000 Certified Subject Code & Name : CS 1202

More information

COMP322 - Introduction to C++ Lecture 02 - Basics of C++

COMP322 - 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 information

CSCI 171 Chapter Outlines

CSCI 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 information

Lexical Considerations

Lexical 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 information

Introduction to C++ Systems Programming

Introduction to C++ Systems Programming Introduction to C++ Systems Programming Introduction to C++ Syntax differences between C and C++ A Simple C++ Example C++ Input/Output C++ Libraries C++ Header Files Another Simple C++ Example Inline Functions

More information

CS3157: Advanced Programming. Outline

CS3157: Advanced Programming. Outline CS3157: Advanced Programming Lecture #12 Apr 3 Shlomo Hershkop shlomo@cs.columbia.edu 1 Outline Intro CPP Boring stuff: Language basics: identifiers, data types, operators, type conversions, branching

More information

STRUCTURING OF PROGRAM

STRUCTURING OF PROGRAM Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the

More information

CodeWarrior 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 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 information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP 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 information

C Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS

C 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 information

The SPL Programming Language Reference Manual

The 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 information

C-LANGUAGE CURRICULAM

C-LANGUAGE CURRICULAM C-LANGUAGE CURRICULAM Duration: 2 Months. 1. Introducing C 1.1 History of C Origin Standardization C-Based Languages 1.2 Strengths and Weaknesses Of C Strengths Weaknesses Effective Use of C 2. C Fundamentals

More information

A Taxonomy of Expression Value Categories

A Taxonomy of Expression Value Categories Document: Author: Date: 2010-03-12 Revision: 6 PL22.16/10-0045 = WG21 N3055 William M. Miller Edison Design Group A Taxonomy of Expression Value Categories Revision History: Revision 6 (PL22.16/10-0045

More information

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

LESSON 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 information

About 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 information

Page 1. Stuff. Last Time. Today. Safety-Critical Systems MISRA-C. Terminology. Interrupts Inline assembly Intrinsics

Page 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 information

Index COPYRIGHTED MATERIAL

Index COPYRIGHTED MATERIAL Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

Quiz Start Time: 09:34 PM Time Left 82 sec(s)

Quiz Start Time: 09:34 PM Time Left 82 sec(s) Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability

More information

CS201 Latest Solved MCQs

CS201 Latest Solved MCQs Quiz Start Time: 09:34 PM Time Left 82 sec(s) Question # 1 of 10 ( Start time: 09:34:54 PM ) Total Marks: 1 While developing a program; should we think about the user interface? //handouts main reusability

More information

A Fast Review of C Essentials Part I

A 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 information

ARM. Compiler toolchain v4.1 for. Errors and Warnings Reference. Copyright 2011 ARM. All rights reserved. ARM DUI 0591A (ID061811)

ARM. Compiler toolchain v4.1 for. Errors and Warnings Reference. Copyright 2011 ARM. All rights reserved. ARM DUI 0591A (ID061811) ARM Compiler toolchain v4.1 for µvision Errors and Warnings Reference Copyright 2011 ARM. All rights reserved. ARM DUI 0591A () ARM Compiler toolchain v4.1 for µvision Errors and Warnings Reference Copyright

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions.

I BSc(IT) [ Batch] Semester II Core: Object Oriented Programming With C plus plus - 212A Multiple Choice Questions. Dr.G.R.Damodaran College of Science (Autonomous, affiliated to the Bharathiar University, recognized by the UGC)Reaccredited at the 'A' Grade Level by the NAAC and ISO 9001:2008 Certified CRISL rated 'A'

More information

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Index. 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 information

UNIT 3

UNIT 3 UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

More information

Table of Contents Preface Bare Necessities... 17

Table of Contents Preface Bare Necessities... 17 Table of Contents Preface... 13 What this book is about?... 13 Who is this book for?... 14 What to read next?... 14 Personages... 14 Style conventions... 15 More information... 15 Bare Necessities... 17

More information

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT Two Mark Questions UNIT - I 1. DEFINE ENCAPSULATION. Encapsulation is the process of combining data and functions

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

MISRA-C. Subset of the C language for critical systems

MISRA-C. Subset of the C language for critical systems MISRA-C Subset of the C language for critical systems SAFETY-CRITICAL SYSTEMS System is safety-critical if people might die due to software bugs Examples Automobile stability / traction control Medical

More information

Chapter 15 - C++ As A "Better C"

Chapter 15 - C++ As A Better C Chapter 15 - C++ As A "Better C" Outline 15.1 Introduction 15.2 C++ 15.3 A Simple Program: Adding Two Integers 15.4 C++ Standard Library 15.5 Header Files 15.6 Inline Functions 15.7 References and Reference

More information

Fundamental of Programming (C)

Fundamental 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 information

Programming in C++ 5. Integral data types

Programming in C++ 5. Integral data types Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long

More information

C Legacy Code Topics. Objectives. In this appendix you ll:

C Legacy Code Topics. Objectives. In this appendix you ll: cppfp2_appf_legacycode.fm Page 1 Monday, March 25, 2013 3:44 PM F C Legacy Code Topics Objectives In this appendix you ll: Redirect keyboard input to come from a file and redirect screen output to a file.

More information

dewhurst_index.qxd 10/16/02 1:54 PM Page 309 Index

dewhurst_index.qxd 10/16/02 1:54 PM Page 309 Index dewhurst_index.qxd 10/16/02 1:54 PM Page 309 Index, (comma operator), 39 40?: (conditional operator), 15 16, 40 41 [ ] (allocating and deleting arrays), 35, 36, 168 ( ) (allocating arrays), 35 -> (arrow

More information

Programming in C and C++

Programming 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 information

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts

Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts Introduction to C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by Walter

More information

APPENDIX A : Example Standard <--Prev page Next page -->

APPENDIX A : Example Standard <--Prev page Next page --> APPENDIX A : Example Standard If you have no time to define your own standards, then this appendix offers you a pre-cooked set. They are deliberately brief, firstly because standards

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

CprE 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 information

Important From Last Time

Important From Last Time Important From Last Time Volatile is tricky To write correct embedded C and C++, you have to understand what volatile does and does not do Ø What is the guarantee that it provides? Don t make the 8 mistakes

More information

2 ADT Programming User-defined abstract data types

2 ADT Programming User-defined abstract data types Preview 2 ADT Programming User-defined abstract data types user-defined data types in C++: classes constructors and destructors const accessor functions, and inline functions special initialization construct

More information

Programming vulnerabilities for C++ (part of WG23 N0746)

Programming vulnerabilities for C++ (part of WG23 N0746) Document number:p0799r0 Date: 20171016 (pre-albuquerque) Project: Programming Language C++, WG21, SG12 Authors: Stephen Michel, Chris Szalwinski, Michael Wong, Hubert Tong, Email: stephen.michell@maurya.on.ca,

More information

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming

More information

Rvalue References as Funny Lvalues

Rvalue References as Funny Lvalues I. Background Document: Author: Date: 2009-11-09 Revision: 1 PL22.16/09-0200 = WG21 N3010 William M. Miller Edison Design Group Rvalue References as Funny Lvalues Rvalue references were introduced into

More information

Input And Output of C++

Input And Output of C++ Input And Output of C++ Input And Output of C++ Seperating Lines of Output New lines in output Recall: "\n" "newline" A second method: object endl Examples: cout

More information

Programming Languages Third Edition. Chapter 9 Control I Expressions and Statements

Programming 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 information

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

IBM i Version 7.2. Programming IBM Rational Development Studio for i ILE C/C++ Language Reference IBM SC

IBM i Version 7.2. Programming IBM Rational Development Studio for i ILE C/C++ Language Reference IBM SC IBM i Version 7.2 Programming IBM Rational Development Studio for i ILE C/C++ Language Reference IBM SC09-7852-03 IBM i Version 7.2 Programming IBM Rational Development Studio for i ILE C/C++ Language

More information

edunepal_info

edunepal_info facebook.com/edunepal.info @ edunepal_info C interview questions (1 125) C interview questions are given with the answers in this website. We have given C interview questions faced by freshers and experienced

More information

September 10,

September 10, September 10, 2013 1 Bjarne Stroustrup, AT&T Bell Labs, early 80s cfront original C++ to C translator Difficult to debug Potentially inefficient Many native compilers exist today C++ is mostly upward compatible

More information

Fundamentals of Programming

Fundamentals 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 information