This document provides an introduction to PC-lint, a static code analysis tool for C and C++. It discusses some common mistakes made in C and C++ programs that PC-lint can detect. It then gives an overview of PC-lint, describing what it is, the types of checks it performs, and some of its key features like weak definials checking, const-correctness checking, value tracking, semantics analysis, multi-thread support, and support for MISRA coding standards. The document concludes by demonstrating how to use PC-lint via the command line and customize its message output.
This document discusses bootloaders, specifically the Universal Boot Loader (U-Boot). It provides an overview of bootloader concepts, U-Boot specifics, the U-Boot initialization sequence, how U-Boot passes arguments to the kernel, hands-on with U-Boot commands, the U-Boot source code structure, configuring and compiling U-Boot for a board, and porting U-Boot to support a new board.
The document discusses various topics related to Linux administration. It covers Unix system architecture, the Linux command line, files and directories, running programs, wildcards, text editors, shells, command syntax, filenames, command history, paths, hidden files, home directories, making directories, copying and renaming files, and more. It provides an overview of key Linux concepts and commands for system administration.
The document discusses the Serial Peripheral Interface (SPI) driver framework in Linux. It describes the SPI protocol and components of the SPI framework, including the SPI master driver, SPI device driver, and SPI client drivers. It explains how the SPI core layer implements SPI bus transactions and how SPI client drivers interface with SPI devices to perform operations like reading and writing.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
Join this video course on Udemy. Click the below link
https://www.udemy.com/mastering-rtos-hands-on-with-freertos-arduino-and-stm32fx/?couponCode=SLIDESHARE
>> The Complete FreeRTOS Course with Programming and Debugging <<
"The Biggest objective of this course is to demystifying RTOS practically using FreeRTOS and STM32 MCUs"
STEP-by-STEP guide to port/run FreeRTOS using development setup which includes,
1) Eclipse + STM32F4xx + FreeRTOS + SEGGER SystemView
2) FreeRTOS+Simulator (For windows)
Demystifying the complete Architecture (ARM Cortex M) related code of FreeRTOS which will massively help you to put this kernel on any target hardware of your choice.
Essentials of Multithreaded System Programming in C++Shuo Chen
This document discusses challenges in multithreaded system programming in C++. It covers topics such as thread safety of libraries, RAII and fork(), signals and threads, and operating file descriptors in threads. The document is intended for C++ programmers familiar with threads and aims to explain interactions between threads and system calls/libraries to avoid common issues.
The document discusses different approaches used by operating systems to detect hardware components during system boot. It describes methods like hardcoding details, using static configuration, device trees, and dynamic configuration via ACPI and bus-based detection. ACPI is covered in depth, including its components, tables, and complexity. Platform and PCI devices are also briefly explained.
This document discusses bootloaders, specifically the Universal Boot Loader (U-Boot). It provides an overview of bootloader concepts, U-Boot specifics, the U-Boot initialization sequence, how U-Boot passes arguments to the kernel, hands-on with U-Boot commands, the U-Boot source code structure, configuring and compiling U-Boot for a board, and porting U-Boot to support a new board.
The document discusses various topics related to Linux administration. It covers Unix system architecture, the Linux command line, files and directories, running programs, wildcards, text editors, shells, command syntax, filenames, command history, paths, hidden files, home directories, making directories, copying and renaming files, and more. It provides an overview of key Linux concepts and commands for system administration.
The document discusses the Serial Peripheral Interface (SPI) driver framework in Linux. It describes the SPI protocol and components of the SPI framework, including the SPI master driver, SPI device driver, and SPI client drivers. It explains how the SPI core layer implements SPI bus transactions and how SPI client drivers interface with SPI devices to perform operations like reading and writing.
This course gets you started with writing device drivers in Linux by providing real time hardware exposure. Equip you with real-time tools, debugging techniques and industry usage in a hands-on manner. Dedicated hardware by Emertxe's device driver learning kit. Special focus on character and USB device drivers.
Join this video course on Udemy. Click the below link
https://www.udemy.com/mastering-rtos-hands-on-with-freertos-arduino-and-stm32fx/?couponCode=SLIDESHARE
>> The Complete FreeRTOS Course with Programming and Debugging <<
"The Biggest objective of this course is to demystifying RTOS practically using FreeRTOS and STM32 MCUs"
STEP-by-STEP guide to port/run FreeRTOS using development setup which includes,
1) Eclipse + STM32F4xx + FreeRTOS + SEGGER SystemView
2) FreeRTOS+Simulator (For windows)
Demystifying the complete Architecture (ARM Cortex M) related code of FreeRTOS which will massively help you to put this kernel on any target hardware of your choice.
Essentials of Multithreaded System Programming in C++Shuo Chen
This document discusses challenges in multithreaded system programming in C++. It covers topics such as thread safety of libraries, RAII and fork(), signals and threads, and operating file descriptors in threads. The document is intended for C++ programmers familiar with threads and aims to explain interactions between threads and system calls/libraries to avoid common issues.
The document discusses different approaches used by operating systems to detect hardware components during system boot. It describes methods like hardcoding details, using static configuration, device trees, and dynamic configuration via ACPI and bus-based detection. ACPI is covered in depth, including its components, tables, and complexity. Platform and PCI devices are also briefly explained.
Here are some key things to practice with regular expressions using grep, sed and awk:
- Use grep to search files for patterns using basic regex metacharacters like ^, $, ., *, [, ], etc.
- Use sed for search and replace operations on files using regex to match patterns
- Use awk to parse files into fields based on delimiters like space, comma etc and perform operations on the fields stored in variables $1, $2 etc.
- Write simple awk scripts to print, filter and manipulate data from files. For example print certain fields, filter rows, perform calculations etc.
- Learn about more advanced regex features supported by tools like extended regex in grep, backreferences in sed etc
The document discusses process management in Linux, including scheduling, context switching, and real-time systems. It defines process scheduling as determining which ready process moves to the running state, with the goal of keeping the CPU busy and minimizing response times. Context switching is described as storing the state of a process when it stops running so the CPU can restore another process's state when it starts running. CPU scheduling decisions occur when a process changes state, such as from running to waiting. Real-time systems must meet strict deadlines, and the document discusses soft and hard real-time systems as well as differences between general purpose, real-time, and embedded operating systems.
The document provides an overview of the Linux kernel architecture and processes. It discusses key kernel concepts like the monolithic kernel design, system calls, loadable modules, virtual memory, and preemptive multitasking. It also covers kernel functions, layers, and context switching between processes. The CPU scheduler, multi-threading, inter-process communication techniques, and tunable kernel parameters are summarized as well.
Join this video course on Udemy. Click the below link
https://www.udemy.com/mastering-rtos-hands-on-with-freertos-arduino-and-stm32fx/?couponCode=SLIDESHARE
>> The Complete FreeRTOS Course with Programming and Debugging <<
"The Biggest objective of this course is to demystifying RTOS practically using FreeRTOS and STM32 MCUs"
STEP-by-STEP guide to port/run FreeRTOS using development setup which includes,
1) Eclipse + STM32F4xx + FreeRTOS + SEGGER SystemView
2) FreeRTOS+Simulator (For windows)
Demystifying the complete Architecture (ARM Cortex M) related code of FreeRTOS which will massively help you to put this kernel on any target hardware of your choice.
The document provides an overview of device driver development in Linux, including character device drivers. It discusses topics such as device driver types, kernel subsystems, compiling and loading kernel modules, the __init and __exit macros, character device registration, and issues around reference counting when removing modules. It also provides sample code for a basic character device driver that prints information to the kernel log.
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...Adrian Huang
This document describes setting up a QEMU virtual machine with Ubuntu 20.04.1 to debug Linux kernel code using gdb. It has a 2-socket CPU configuration with 16GB of memory and disabled KASAN and ASLR. The QEMU VM can be used to run sample code and observe Linux kernel behavior under gdb, such as setting conditional breakpoints to analyze page fault behavior for mmap addresses by referencing a gdb debugging text file.
The document discusses the booting process of the BeagleBone Black. It begins with an overview of the PC and BeagleBone booting processes. It then covers booting through an SD card, including partitioning and creating a root filesystem. The document introduces bootloaders like U-Boot, describes serial booting, and how to add commands to U-Boot. It provides hands-on examples of bringing up the BeagleBone board from recovery.
This document discusses various concepts related to file input/output (I/O) in Linux system programming. It covers opening, reading from, writing to, closing, seeking within, and truncating files using system calls like open(), read(), write(), close(), lseek(), ftruncate(). It also discusses related topics like file descriptors, blocking vs non-blocking I/O, synchronized I/O, direct I/O, and positional reads/writes.
The document discusses Linux network drivers and provides information about:
- The Linux network subsystem and protocol stack, typically using TCP/IP.
- Network interface card (NIC) drivers which provide a uniform interface for the network layer to access physical network cards.
- Key data structures like struct sk_buff and struct net_device that network drivers interact with for packet handling and device operations.
- Functions for network device registration, open/close, interrupt handling, and flow control.
- Examples of simple network drivers and how to write one for a Realtek NIC.
The document discusses the construction of the Linux kernel image. It describes how the kernel code is organized and hardware-independent. It then explains the process of building the composite kernel image (vmlinux) by linking object files together. This involves using the linker to combine files like head.o, piggy.o and misc.o into a binary image. It also discusses the roles of the bootstrap loader and how it loads and decompresses the kernel image.
This document discusses Python database programming. It introduces databases and how they store data in tables connected through columns. It discusses SQL for creating, accessing, and manipulating database data. It then discusses how Python supports various databases and database operations. It covers the Python DB-API for providing a standard interface for database programming. It provides examples of connecting to a database, executing queries, and retrieving and inserting data.
This document discusses user administration in Linux. It describes the different types of user accounts - root, system, and user accounts. The root account has complete control while system accounts are for specific system functions. User accounts provide interactive access for general users. Groups are used to logically group user accounts. The main user administration files are /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow. Basic commands for managing users include useradd, usermod, userdel, groupadd, groupmod, and groupdel. Creating, modifying, and deleting users and groups are demonstrated.
Linux is an operating system or a kernel. It is distributed under an open source license. Its functionality list is quite like UNIX. Linux is an operating system or a kernel which germinated as an idea in the mind of young and bright Linus Torvalds when he was a computer science student. The main advantage of Linux was that programmers were able to use the Linux Kernel to design their own custom operating systems. With time, a new range of user-friendly OS's stormed the computer world. Now, Linux is one of the most popular and widely used Kernel, and it is the backbone of popular operating systems like Debian, Knoppix, Ubuntu, and Fedora.
Linux uses a preemptive multilevel feedback queue scheduling algorithm. Processes have both static priorities based on nice values and dynamic priorities based on recent CPU usage. The scheduler selects from two lists of active and expired processes using their dynamic priorities. It also performs load balancing across CPU runqueues to improve performance on multiprocessor systems. System calls like setpriority(), sched_setscheduler(), and sched_yield() allow modifying process priorities and scheduling policies.
This document discusses character drivers in Linux. It covers the basics of character drivers including what they represent ("character" refers to devices that transfer data as a stream of bytes), major and minor numbers which identify devices, registering and unregistering drivers, implementing file operations like read and write, and using the Linux device model to dynamically create and manage devices with udev. The document provides code examples and explains key concepts like the file structures and I/O control interfaces that device drivers use to interface with the kernel and userspace.
This document discusses making Linux capable of hard real-time performance. It begins by defining hard and soft real-time systems and explaining that real-time does not necessarily mean fast but rather determinism. It then covers general concepts around real-time performance in Linux like preemption, interrupts, context switching, and scheduling. Specific features in Linux like RT-Preempt, priority inheritance, and threaded interrupts that improve real-time capabilities are also summarized.
Here are the key differences between relative and absolute paths in Linux:
- Relative paths specify a location relative to the current working directory, while absolute paths specify a location from the root directory.
- Relative paths start from the current directory, denoted by a period (.). Absolute paths always start from the root directory, denoted by a forward slash (/).
- Relative paths are dependent on the current working directory and may change if the working directory changes. Absolute paths will always refer to the same location regardless of current working directory.
- Examples:
- Relative: ./file.txt (current directory)
- Absolute: /home/user/file.txt (from root directory)
So in summary, relative paths
- Shell scripting allows users to automate repetitive tasks by writing scripts of shell commands that can be executed automatically. The shell acts as an interface between the user and the operating system kernel, accepting commands and passing them to the kernel for execution. Common shells used for scripting include Bash, C Shell, and Korn Shell. Shell scripts use shell commands, control structures, and functions to perform automated tasks like backups and system monitoring.
The document discusses installing and configuring various Linux applications including Apache, PHP, MySQL, and Postgres. It covers basic Ubuntu installation, system configuration, installing packages, configuring Apache, PHP, and MySQL. Specific instructions are provided for installing Apache, configuring virtual hosts and SSL, installing PHP, and installing and configuring MySQL and phpMyAdmin.
Cppcheck is a free static code analysis tool that finds bugs in C and C++ code without executing the program. It works by tokenizing, simplifying, and checking code for patterns that may indicate bugs. Some checks look for buffer overruns, unused functions, memory leaks, and invalid arguments. Cppcheck is cross-platform, has a GUI and command line interface, and has found hundreds of bugs in open source projects.
Slide 2:
Finding bugs is like counting black cats in a dark room at midnight."
Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools, it
doesn’t detect syntax errors. Cppcheck only detects the types of bugs that the compilers normally fail to
detect. The goal is no false positives.
Supported code and platforms:
• You can check non-standard code that includes various compiler extensions, inline assembly code, etc.
• Cppcheck should be compilable by any C++ compiler that handles the latest C++ standard.
• Cppcheck should work on any platform that has sufficient CPU and memory.
Accuracy
Please understand that there are limits of Cppcheck. Cppcheck is rarely wrong about reported errors. But
there are many bugs that it doesn’t detect.
You will find more bugs in your software by testing your software carefully, than by using Cppcheck.
You will find more bugs in your software by instrumenting your software, than by using Cppcheck. But
Cppcheck can still detect some of the bugs that you miss when testing and instrumenting your software.
Slide 4 :
Normally a program has many source files. And you want to check them all. Cppcheck can check all
source files in a directory:
If "path" is a folder then cppcheck will check all source files in this folder.
Slide 5 :
The first option is to only provide the paths and files you want to check.
cppcheck src/a src/b
All files under src/a and src/b are then checked.
The second option is to use -i, with it you specify files/paths to ignore. With this command no files in
src/c are checked:
cppcheck -isrc/c src
Slide 6 :
The possible severities for messages are:
error
used when bugs are found
warning
suggestions about defensive programming to prevent bugs
style
stylistic issues related to code cleanup (unused functions, redundant code, constness, and such)
performance
Suggestions for making the code faster. These suggestions are only based on common knowledge. It
is not certain you’ll get any measurable difference in speed by fixing these messages.
portability
portability warnings. 64-bit portability. code might work different on different compilers. etc.
information
Informational messages about checking problems.
Slide 7 :
By default only error messages are shown. Through the --enable command more checks can be
enabled.
Here are some key things to practice with regular expressions using grep, sed and awk:
- Use grep to search files for patterns using basic regex metacharacters like ^, $, ., *, [, ], etc.
- Use sed for search and replace operations on files using regex to match patterns
- Use awk to parse files into fields based on delimiters like space, comma etc and perform operations on the fields stored in variables $1, $2 etc.
- Write simple awk scripts to print, filter and manipulate data from files. For example print certain fields, filter rows, perform calculations etc.
- Learn about more advanced regex features supported by tools like extended regex in grep, backreferences in sed etc
The document discusses process management in Linux, including scheduling, context switching, and real-time systems. It defines process scheduling as determining which ready process moves to the running state, with the goal of keeping the CPU busy and minimizing response times. Context switching is described as storing the state of a process when it stops running so the CPU can restore another process's state when it starts running. CPU scheduling decisions occur when a process changes state, such as from running to waiting. Real-time systems must meet strict deadlines, and the document discusses soft and hard real-time systems as well as differences between general purpose, real-time, and embedded operating systems.
The document provides an overview of the Linux kernel architecture and processes. It discusses key kernel concepts like the monolithic kernel design, system calls, loadable modules, virtual memory, and preemptive multitasking. It also covers kernel functions, layers, and context switching between processes. The CPU scheduler, multi-threading, inter-process communication techniques, and tunable kernel parameters are summarized as well.
Join this video course on Udemy. Click the below link
https://www.udemy.com/mastering-rtos-hands-on-with-freertos-arduino-and-stm32fx/?couponCode=SLIDESHARE
>> The Complete FreeRTOS Course with Programming and Debugging <<
"The Biggest objective of this course is to demystifying RTOS practically using FreeRTOS and STM32 MCUs"
STEP-by-STEP guide to port/run FreeRTOS using development setup which includes,
1) Eclipse + STM32F4xx + FreeRTOS + SEGGER SystemView
2) FreeRTOS+Simulator (For windows)
Demystifying the complete Architecture (ARM Cortex M) related code of FreeRTOS which will massively help you to put this kernel on any target hardware of your choice.
The document provides an overview of device driver development in Linux, including character device drivers. It discusses topics such as device driver types, kernel subsystems, compiling and loading kernel modules, the __init and __exit macros, character device registration, and issues around reference counting when removing modules. It also provides sample code for a basic character device driver that prints information to the kernel log.
qemu + gdb + sample_code: Run sample code in QEMU OS and observe Linux Kernel...Adrian Huang
This document describes setting up a QEMU virtual machine with Ubuntu 20.04.1 to debug Linux kernel code using gdb. It has a 2-socket CPU configuration with 16GB of memory and disabled KASAN and ASLR. The QEMU VM can be used to run sample code and observe Linux kernel behavior under gdb, such as setting conditional breakpoints to analyze page fault behavior for mmap addresses by referencing a gdb debugging text file.
The document discusses the booting process of the BeagleBone Black. It begins with an overview of the PC and BeagleBone booting processes. It then covers booting through an SD card, including partitioning and creating a root filesystem. The document introduces bootloaders like U-Boot, describes serial booting, and how to add commands to U-Boot. It provides hands-on examples of bringing up the BeagleBone board from recovery.
This document discusses various concepts related to file input/output (I/O) in Linux system programming. It covers opening, reading from, writing to, closing, seeking within, and truncating files using system calls like open(), read(), write(), close(), lseek(), ftruncate(). It also discusses related topics like file descriptors, blocking vs non-blocking I/O, synchronized I/O, direct I/O, and positional reads/writes.
The document discusses Linux network drivers and provides information about:
- The Linux network subsystem and protocol stack, typically using TCP/IP.
- Network interface card (NIC) drivers which provide a uniform interface for the network layer to access physical network cards.
- Key data structures like struct sk_buff and struct net_device that network drivers interact with for packet handling and device operations.
- Functions for network device registration, open/close, interrupt handling, and flow control.
- Examples of simple network drivers and how to write one for a Realtek NIC.
The document discusses the construction of the Linux kernel image. It describes how the kernel code is organized and hardware-independent. It then explains the process of building the composite kernel image (vmlinux) by linking object files together. This involves using the linker to combine files like head.o, piggy.o and misc.o into a binary image. It also discusses the roles of the bootstrap loader and how it loads and decompresses the kernel image.
This document discusses Python database programming. It introduces databases and how they store data in tables connected through columns. It discusses SQL for creating, accessing, and manipulating database data. It then discusses how Python supports various databases and database operations. It covers the Python DB-API for providing a standard interface for database programming. It provides examples of connecting to a database, executing queries, and retrieving and inserting data.
This document discusses user administration in Linux. It describes the different types of user accounts - root, system, and user accounts. The root account has complete control while system accounts are for specific system functions. User accounts provide interactive access for general users. Groups are used to logically group user accounts. The main user administration files are /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow. Basic commands for managing users include useradd, usermod, userdel, groupadd, groupmod, and groupdel. Creating, modifying, and deleting users and groups are demonstrated.
Linux is an operating system or a kernel. It is distributed under an open source license. Its functionality list is quite like UNIX. Linux is an operating system or a kernel which germinated as an idea in the mind of young and bright Linus Torvalds when he was a computer science student. The main advantage of Linux was that programmers were able to use the Linux Kernel to design their own custom operating systems. With time, a new range of user-friendly OS's stormed the computer world. Now, Linux is one of the most popular and widely used Kernel, and it is the backbone of popular operating systems like Debian, Knoppix, Ubuntu, and Fedora.
Linux uses a preemptive multilevel feedback queue scheduling algorithm. Processes have both static priorities based on nice values and dynamic priorities based on recent CPU usage. The scheduler selects from two lists of active and expired processes using their dynamic priorities. It also performs load balancing across CPU runqueues to improve performance on multiprocessor systems. System calls like setpriority(), sched_setscheduler(), and sched_yield() allow modifying process priorities and scheduling policies.
This document discusses character drivers in Linux. It covers the basics of character drivers including what they represent ("character" refers to devices that transfer data as a stream of bytes), major and minor numbers which identify devices, registering and unregistering drivers, implementing file operations like read and write, and using the Linux device model to dynamically create and manage devices with udev. The document provides code examples and explains key concepts like the file structures and I/O control interfaces that device drivers use to interface with the kernel and userspace.
This document discusses making Linux capable of hard real-time performance. It begins by defining hard and soft real-time systems and explaining that real-time does not necessarily mean fast but rather determinism. It then covers general concepts around real-time performance in Linux like preemption, interrupts, context switching, and scheduling. Specific features in Linux like RT-Preempt, priority inheritance, and threaded interrupts that improve real-time capabilities are also summarized.
Here are the key differences between relative and absolute paths in Linux:
- Relative paths specify a location relative to the current working directory, while absolute paths specify a location from the root directory.
- Relative paths start from the current directory, denoted by a period (.). Absolute paths always start from the root directory, denoted by a forward slash (/).
- Relative paths are dependent on the current working directory and may change if the working directory changes. Absolute paths will always refer to the same location regardless of current working directory.
- Examples:
- Relative: ./file.txt (current directory)
- Absolute: /home/user/file.txt (from root directory)
So in summary, relative paths
- Shell scripting allows users to automate repetitive tasks by writing scripts of shell commands that can be executed automatically. The shell acts as an interface between the user and the operating system kernel, accepting commands and passing them to the kernel for execution. Common shells used for scripting include Bash, C Shell, and Korn Shell. Shell scripts use shell commands, control structures, and functions to perform automated tasks like backups and system monitoring.
The document discusses installing and configuring various Linux applications including Apache, PHP, MySQL, and Postgres. It covers basic Ubuntu installation, system configuration, installing packages, configuring Apache, PHP, and MySQL. Specific instructions are provided for installing Apache, configuring virtual hosts and SSL, installing PHP, and installing and configuring MySQL and phpMyAdmin.
Cppcheck is a free static code analysis tool that finds bugs in C and C++ code without executing the program. It works by tokenizing, simplifying, and checking code for patterns that may indicate bugs. Some checks look for buffer overruns, unused functions, memory leaks, and invalid arguments. Cppcheck is cross-platform, has a GUI and command line interface, and has found hundreds of bugs in open source projects.
Slide 2:
Finding bugs is like counting black cats in a dark room at midnight."
Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools, it
doesn’t detect syntax errors. Cppcheck only detects the types of bugs that the compilers normally fail to
detect. The goal is no false positives.
Supported code and platforms:
• You can check non-standard code that includes various compiler extensions, inline assembly code, etc.
• Cppcheck should be compilable by any C++ compiler that handles the latest C++ standard.
• Cppcheck should work on any platform that has sufficient CPU and memory.
Accuracy
Please understand that there are limits of Cppcheck. Cppcheck is rarely wrong about reported errors. But
there are many bugs that it doesn’t detect.
You will find more bugs in your software by testing your software carefully, than by using Cppcheck.
You will find more bugs in your software by instrumenting your software, than by using Cppcheck. But
Cppcheck can still detect some of the bugs that you miss when testing and instrumenting your software.
Slide 4 :
Normally a program has many source files. And you want to check them all. Cppcheck can check all
source files in a directory:
If "path" is a folder then cppcheck will check all source files in this folder.
Slide 5 :
The first option is to only provide the paths and files you want to check.
cppcheck src/a src/b
All files under src/a and src/b are then checked.
The second option is to use -i, with it you specify files/paths to ignore. With this command no files in
src/c are checked:
cppcheck -isrc/c src
Slide 6 :
The possible severities for messages are:
error
used when bugs are found
warning
suggestions about defensive programming to prevent bugs
style
stylistic issues related to code cleanup (unused functions, redundant code, constness, and such)
performance
Suggestions for making the code faster. These suggestions are only based on common knowledge. It
is not certain you’ll get any measurable difference in speed by fixing these messages.
portability
portability warnings. 64-bit portability. code might work different on different compilers. etc.
information
Informational messages about checking problems.
Slide 7 :
By default only error messages are shown. Through the --enable command more checks can be
enabled.
The document provides principles and techniques for writing efficient software. It begins by defining efficiency as doing things using as few resources as possible, such as memory and execution time. An example is given of optimizing a memory fill routine through several iterations. Each version is measured to analyze performance improvements. The biggest gains came from using word access and loop unrolling techniques. Later versions increased complexity significantly. The document concludes with several principles for writing efficient software, such as understanding the system, measuring performance, and not optimizing prematurely.
Slides and notes presented at Albany.pm on Thursday, January 23, 2014, covering static code analysis and an internal perl tool AutoLint, which automates Gimpel PC-Lint runs over large legacy C/C++ codebases. (The per-slide notes contain most of the spoken content.)
Александр Сомов "C++: препроцессор, компилятор, компоновщик"Yandex
Из этого доклада вы узнаете, как разбирать различные ошибки сборки C++, как их исправлять и что для этого нужно знать.
Речь пойдет о стадиях сборки программы на C++ и о том, как устроены объектные файлы (на примере формата ELF), о работе компилятора и компоновщика, а также особенностях, связанных со спецификой языка. В заключительной части доклада будут разобраны принципы работы препроцессора C++ и способы его отладки.
Frama-C is a platform for static analysis of C source code. It can extract semantic information from code by collaborating with plugins. The document discusses various Frama-C plugins such as metrics computation, slicing, and value analysis that provide capabilities like measuring code characteristics, removing unused code, and identifying variable usage. The plugins help analyze code structure and behavior to find defects, understand code architecture, and measure differences between versions.
Static Analysis and the FDA Guidance for Medical Device SoftwareErika Barron
This document discusses how static analysis and the MISRA coding standards can help medical device companies comply with FDA guidelines for software development. It provides an overview of the FDA's guidance on software validation and defect prevention. The document argues that MISRA is a good option for medical software because it provides well-defined, auditable coding standards and a process for justifying and documenting deviations. Adopting MISRA allows companies to leverage its proven standards and traceability features to facilitate FDA compliance and software quality.
Studies show that for every 7 to 10 lines of code we write, we introduce one defect. Now often times we can spot these errors before they ever see the light of day, however that is not true in all cases. So what can we use to assist us in leveling the playing field? Well, we can take advantage of Static Code Analysis tools! In this talk, learn how you can incorporate the following tools into your development process: Checkstyle, PMD, FindBugs, and Lint.
This document discusses using the Frama-C framework to formally verify C and C++ code. It provides examples of using Frama-C to verify functions that find the minimum of integer values, including abs(), min(), and min3(). Specifications for these functions are written using the ACSL specification language. Frama-C is then used to prove that the implementations satisfy the specifications. The document also discusses how concepts from Frama-C like LE (less than or equal) can be mapped to similar concepts in languages like Coq that are used for formal verification.
This document discusses how to use gcov and lcov to generate code coverage reports from C/C++ code. It explains that gcov collects coverage data during program execution, while lcov generates HTML reports from this data and source code files. The document then provides steps for compiling code with coverage collection enabled, running the code to generate coverage data files, and using lcov to produce an HTML report annotating the source with coverage information. An example is included, and the document closes with a Q&A section and thanks.
Automation using RobotFramework for embedded deviceSrix Sriramkumar
In this talk at #rootconf 2014, Sriram talks about his experience in designing an internal test automation framework. He also shares his experience and insights in using Robot framework for KDT and DDT test automation.
Hi I’m Cris, iOS Developer in KLabCyscorpions. In this post, I want to share with you my presentation on Code Review guidelines for iOS.
But, what is Code Review?
According to Wikipedia:
“Code Review is systematic examination (often known as peer review) of computer source code. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers’ skills. Reviews are done in various forms such as pair programming, informal walkthroughs, and formal inspections.”
Want to review code? Then First things first! For you to review code effectively, you need the basic know-how of reviewing code as both the developer and the reviewer. These slides will give some guidelines on how to think in both these roles when reviewing code.
Las abuelas modernas han cambiado el punto cruz tradicional por el punto com. La autora cuenta cómo compró una computadora para comunicarse con sus hijos y nueras a través de correos electrónicos en lugar de llamadas telefónicas, lo que mejoró su relación. Ahora disfruta enviando y recibiendo emails, aunque sufre una compulsión por la computadora.
La Cumparsita es un famoso tango creado en 1915-1916 por el compositor uruguayo Gerardo Matos Rodríguez. Roberto Firpo hizo arreglos musicales a pedido de Matos Rodríguez y tocó la pieza por primera vez con su orquesta. La letra más popular es del argentino Pascual Contursi. Se considera el tango más difundido a nivel mundial.
Nbscore. Nuevo negocio en las agencias de medios. Grupo ConsultoresAraceli Castelló
El documento resume el volumen de nuevo negocio en agencias de medios en España durante el segundo semestre de 2010. Aegis obtuvo la mayor parte con un 36.3%, seguido de Havas con 28%. El volumen total fue similar al primer semestre de 2010 y un 9.3% menor que el segundo semestre de 2009. Los principales ganadores de cuentas fueron Aegis, Havas, Publicis, WPP y Omnicom.
The document is a manual called The Indigo Book that provides an open-source implementation of the Uniform System of Legal Citation (also known as "The Bluebook"). It covers citation rules for U.S. legal materials like cases, statutes, regulations, and other sources. The introduction explains that The Indigo Book is free to use and distribute, unlike The Bluebook, in order to promote accessibility and improvements to the citation system. It aims to be compatible with The Bluebook's rules but may diverge in the future to simplify citations.
“Actitud digital en el nuevo paradigma educativo” - Jornada Menores y disposi...Fundació Bit
El Obervatorio de la Sociedad de la Información (OBSI) de la Fundación Bit organizó para los días 6 y 13 de octubre una jornada sobre menores y TIC dirigida a padres, madres, docentes y otras personas interesadas en la educación y las tecnologías.
El objetivo de esta jornada es generar debate entorno a las oportunidades que nos ofrecen los dispositivos móviles como los smartphones y las tablets y el papel que pueden jugar en la transformación de la educación.
La presentación fue impartida por Montserrat Guitert, directora de Multimedia y Comunicación, y de capacitación TIC del Grupo de Investigación en Educación y TIC EduLab de la Universitat Oberta de Catalunya.
Este documento describe el surgimiento y evolución de las redes sociales. Comenzaron en la década de 1990 como sitios para mantener contactos de la escuela/universidad y encontrar nuevos amigos. Hoy en día hay más de 200 redes sociales con 800 millones de usuarios a nivel mundial. Los adolescentes valoran la amistad y popularidad, y usan las redes para ampliar su círculo de amigos a través del intercambio de información personal. Sin embargo, también existen riesgos como la exposición y falta de conciencia sobre la privacidad.
Queridxs amiguitxs,
sabéis que estoy haciendo limpieza en casa de mi madre (¡adios a lo viejo, hola a lo nuevo!). Pues bien, hay cosas que tenemos "almacenadas", pero que no usamos, y es hora de dejarlas partir hacia nuevos horizontes.
Me hace ilusión que pasen a vuestras manos, que estarán en buenas idem...jejeje ¡¡¡Total, que si las queréis, son vuestras!!!!
Mi madre vive en Alcalá de Henares (para los que no lo sepáis) y me gustaría darlas antes de mediados de septiembre.
Besitos fuertes fuertes fuertes fuertes...jejeje
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
C++ is known for things such as performance, expressiveness, the lack of a standard build system and package management, complexity and long compile times. The inability to iterate quickly is one of the biggest killers of productivity. This talk is aimed at anyone interested in improving the last of these points - it will provide insights into why compilation (and linking) take so long for C++ and will then provide an exhaustive list of techniques and tools to mitigate the problem, such as: - tooling and infrastructure - hardware, build systems, caching, distributed builds, diagnostics of bottlenecks, code hygiene - techniques - unity builds, precompiled headers, linking (static vs shared libraries) - source code modification - the PIMPL idiom, better template use, annotations - modules - what they are, when they are coming to C++ and what becomes obsolete because of them
A Check of the Open-Source Project WinSCP Developed in Embarcadero C++ BuilderAndrey Karpov
We regularly check open-source C/C++ projects, but what we check are mostly projects developed in the Visual Studio IDE. For some reason, we haven't paid much attention to the Embarcadero C++ Builder IDE. In order to improve this situation, we are going to discuss the WinSCP project I have checked recently.
P.S. C++ Builder support in PVS-Studio had been dropped after version 5.20. If you have any questions, feel free to contact our support.
Keynote (Mike Muller) - Is There Anything New in Heterogeneous Computing - by...AMD Developer Central
Keynote presentation, Is There Anything New in Heterogeneous Computing, by Mike Muller, Chief Technology Officer, ARM, at the AMD Developer Summit (APU13), Nov. 11-13, 2013.
ebpf and IO Visor: The What, how, and what next!Affan Syed
Extended BPF (eBPF) provides a mechanism for running custom programs inside the Linux kernel that can be used for filtering network packets, monitoring system activity, and more. eBPF programs are written in a restricted subset of C and compiled to bytecode that is verified by the kernel for safety before being run. The BCC toolkit makes it easier to write and load eBPF programs. The IO Visor project aims to further develop eBPF and provide tools and use cases for networking, security, and system tracing applications.
Instrumentation of Unsafe C Methods to Safe Methods (Samuel Bret Collie) (1)Samuel Collie
This document outlines an extension to the RTC runtime checking tool to make unsafe C standard library functions safer. The extension instruments function calls to unsafe standard library functions to instead call safe wrapper functions. These wrapper functions, whose source code is visible to RTC, have been instrumented by RTC to add runtime checks. This allows checks to be performed within functions like memcpy that previously did not guarantee spatial or temporal safety. Current drawbacks are interdependencies between unsafe functions and inability to track pointers passed outside the safe library. Future goals include addressing these issues and optimizing the approach.
This document discusses myths and truths about using C++ for embedded systems. It addresses common concerns that C++ is slow, produces large binaries, and leads to non-portable code. The document explains that with a reasonable subset of features, C++ performance can be similar to C, binary sizes similar, and portability improved in modern compilers. It promotes C++ features like classes, templates, and lambdas that can improve code quality while maintaining performance. Overall it argues that with care, C++ can be well-suited for embedded development.
Bounded Model Checking for C Programs in an Enterprise EnvironmentAdaCore
This document discusses using bounded model checking to analyze C programs at scale in an enterprise environment. It describes compiling thousands of software packages using a tool called goto-cc that converts C code to an intermediate representation. This allows running verification tools to find bugs. Many bugs were found and reported, improving quality. The goal is to focus on developing verification methods and analyzing a large codebase to find more bugs and security issues.
This document discusses the key differences between ANSI C and K&R C. It covers four main points: 1) Function prototyping in ANSI C allows compilers to check for invalid function calls, unlike in K&R C. 2) ANSI C supports the const and volatile qualifiers. 3) ANSI C supports internationalization with wide characters and setlocale. 4) ANSI C allows function pointers to be used without dereferencing. The document provides examples to illustrate each point.
C is a general-purpose programming language widely used to develop operating systems and compilers. It was developed in the early 1970s at Bell Labs by Dennis Ritchie. Some key reasons for C's popularity include its efficiency, ability to access low-level hardware, and ability to be compiled on a variety of computers. C source code files use a .c extension and must be compiled into an executable binary file before running. Common uses of C include operating systems, language compilers, databases, and network drivers.
#Include os - From bootloader to REST API with the new C++IncludeOS
The document discusses IncludeOS, a minimal operating system implemented from scratch in C++. It can be included directly in an ELF binary to create a unikernel. IncludeOS is 300x smaller in disk size and 100x less memory usage than traditional operating systems. It supports building REST APIs and web servers directly in C++ applications using the operating system. Drivers are self-registering so applications only link in what they need. Interrupts are handled through delegating to subscriber functions. The document demonstrates building a TCP server and routing in a web application directly in C++ using the IncludeOS APIs and libraries.
In the slide, i describe the basis of python programming and their function. If any doubt in the slide, contact me through mail or linked in. My mail id is mdsathees@gmail.com
The document provides an introduction to the C programming language. It outlines the goals of learning C as being able to write simple programs, understand and modify existing code, and use makefiles. It then covers the basics of C syntax including variables, data types, functions, headers, comments, arithmetic operators, and input/output functions like printf and scanf. It introduces key concepts like compilation, declarations, arrays, and for loops. The overall document serves as a tutorial to teach the basic elements of the C language.
C Programming Training in Ambala ! Batra Computer Centrejatin batra
Batra Computer Centre is An ISO certified 9001:2008 training Centre in Ambala.
We Provide C Programming Training in Ambala. BATRA COMPUTER CENTRE provides best training in C, C++, S.E.O, Web Designing, Web Development and So many other courses are available.
Contains C programming tutorial for beginners with lot of examples explained. This tutorial contains each and every feature of C programming that will help you. C programming tutorial covering basic C Programming examples, data types, functions, loops, arrays, pointers, etc.
UM2019 Extended BPF: A New Type of SoftwareBrendan Gregg
BPF (Berkeley Packet Filter) has evolved from a limited virtual machine for efficient packet filtering to a new type of software called extended BPF. Extended BPF allows for custom, efficient, and production-safe performance analysis tools and observability programs to be run in the Linux kernel through BPF. It enables new event-based applications running as BPF programs attached to various kernel events like kprobes, uprobes, tracepoints, sockets, and more. Major companies like Facebook, Google, and Netflix are using BPF programs for tasks like intrusion detection, container security, firewalling, and observability with over 150,000 AWS instances running BPF programs. BPF provides a new program model and security features compared
The document describes experiments related to system security and digital forensics.
The first experiment involves using static code analysis tools like RATS and Flawfinder to analyze code samples for vulnerabilities. The second experiment describes installing and using the vulnerability scanner Nessus to scan systems for known vulnerabilities.
The third experiment explores using the website copier HTTrack to download a website from the internet to a local directory while preserving the directory structure and links. The fourth experiment demonstrates configuring router security using passwords and access lists on Cisco Packet Tracer to filter traffic between VLANs and networks.
AAME ARM Techcon2013 003v02 Software DevelopmentAnh Dung NGUYEN
This document provides an overview of the Keil MDK development tools and environment for software development on ARM Cortex-M microcontrollers. It describes the μVision IDE, ARM compiler, debugger and other tools. It discusses the embedded development process, including considerations when moving from a development environment to a standalone application such as memory maps, application startup, and C library usage. It also covers optimization levels, language support, variable types, and default memory maps and C libraries provided by the tools.
The document discusses the LLVM compiler framework and infrastructure. It provides reusable components for building compilers to reduce the time and cost of building new compilers. The LLVM compiler framework uses the LLVM infrastructure to build static compilers, JITs, and trace-based optimizers. It emits C code or native code for x86, Sparc, and PowerPC architectures. The three primary LLVM components are the virtual instruction set (the common language- and target-independent intermediate representation), a collection of well-integrated libraries, and a collection of tools built from the libraries.
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfflufftailshop
When it comes to unit testing in the .NET ecosystem, developers have a wide range of options available. Among the most popular choices are NUnit, XUnit, and MSTest. These unit testing frameworks provide essential tools and features to help ensure the quality and reliability of code. However, understanding the differences between these frameworks is crucial for selecting the most suitable one for your projects.
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on automated letter generation for Bonterra Impact Management using Google Workspace or Microsoft 365.
Interested in deploying letter generation automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Fueling AI with Great Data with Airbyte WebinarZilliz
This talk will focus on how to collect data from a variety of sources, leveraging this data for RAG and other GenAI use cases, and finally charting your course to productionalization.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Skybuffer SAM4U tool for SAP license adoptionTatiana Kojar
Manage and optimize your license adoption and consumption with SAM4U, an SAP free customer software asset management tool.
SAM4U, an SAP complimentary software asset management tool for customers, delivers a detailed and well-structured overview of license inventory and usage with a user-friendly interface. We offer a hosted, cost-effective, and performance-optimized SAM4U setup in the Skybuffer Cloud environment. You retain ownership of the system and data, while we manage the ABAP 7.58 infrastructure, ensuring fixed Total Cost of Ownership (TCO) and exceptional services through the SAP Fiori interface.
Programming Foundation Models with DSPy - Meetup SlidesZilliz
Prompting language models is hard, while programming language models is easy. In this talk, I will discuss the state-of-the-art framework DSPy for programming foundation models with its powerful optimizers and runtime constraint system.
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Tatiana Kojar
Skybuffer AI, built on the robust SAP Business Technology Platform (SAP BTP), is the latest and most advanced version of our AI development, reaffirming our commitment to delivering top-tier AI solutions. Skybuffer AI harnesses all the innovative capabilities of the SAP BTP in the AI domain, from Conversational AI to cutting-edge Generative AI and Retrieval-Augmented Generation (RAG). It also helps SAP customers safeguard their investments into SAP Conversational AI and ensure a seamless, one-click transition to SAP Business AI.
With Skybuffer AI, various AI models can be integrated into a single communication channel such as Microsoft Teams. This integration empowers business users with insights drawn from SAP backend systems, enterprise documents, and the expansive knowledge of Generative AI. And the best part of it is that it is all managed through our intuitive no-code Action Server interface, requiring no extensive coding knowledge and making the advanced AI accessible to more users.
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...alexjohnson7307
Predictive maintenance is a proactive approach that anticipates equipment failures before they happen. At the forefront of this innovative strategy is Artificial Intelligence (AI), which brings unprecedented precision and efficiency. AI in predictive maintenance is transforming industries by reducing downtime, minimizing costs, and enhancing productivity.
Ivanti’s Patch Tuesday breakdown goes beyond patching your applications and brings you the intelligence and guidance needed to prioritize where to focus your attention first. Catch early analysis on our Ivanti blog, then join industry expert Chris Goettl for the Patch Tuesday Webinar Event. There we’ll do a deep dive into each of the bulletins and give guidance on the risks associated with the newly-identified vulnerabilities.
Trusted Execution Environment for Decentralized Process MiningLucaBarbaro3
Presentation of the paper "Trusted Execution Environment for Decentralized Process Mining" given during the CAiSE 2024 Conference in Cyprus on June 7, 2024.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
Best 20 SEO Techniques To Improve Website Visibility In SERP
An Introduction to PC-Lint
1. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
1/47
An Introduction to PC-lint
Agenda:
► Introduction
► Features
► Usage
► The true value of PC-lint
Version 1.20
2. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
2/47
“C makes it easy to shoot yourself in the foot...”
(Bjarne Stroustrup)
An Introduction to PC-lint
C is a powerful
but dangerous
language
3. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
3/47
Classic C Mistakes
Only to name a few...
► Array out-of-bounds access
► Null pointer dereferencing
► Using a variable before initialization
► Order of evaluation of operands
► Integer overflow
► Assignment where check for equality was intended
► Illegal printf/scanf format strings
► Forgetting to handle a case in switch statement
► Passing macro arguments with side effects
4. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
4/47
“ ...C++ makes it harder, but when you do,
it blows your whole leg off.”
(Bjarne Stroustrup)
An Introduction to PC-lint
The same holds
for C++
5. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
5/47
Classic C++ Mistakes
Only to name a few...
► Forgetting to initialize class members
► Initializing class members in the wrong order
► Forgetting to declare the base class destructor virtual
► Forgetting to implement the assignment op
► Using auto_ptr on containers
► Memory and resource leaks
► Unhandled exceptions
► Leaking exceptions from destructors
► Order of static initialization
6. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
6/47
The Case For Static Code Checking
C and C++ are powerful but dangerous
Even if code works, it might not be portable/future-proof
► Alignment issues
► Size of scalars
► Compiler-specific features
► …
Traditional testing (checking at run-time)
► Might not detect all issues
► Is expensive
However: static checking
is not meant as a
replacement for testing!
7. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
7/47
What is Lint/PC-lint?
Lint
► Etymology: undesired fibers and fluff in sheep's wool
► Seventh version (V7) of Unix (1979)
► Part of PCC (portable C compiler)
PC-lint
► Commercial version for C and C++
► Produced by Gimpel Software, USA.
► First version appeared 1985
► Current version is 9.00
► FlexeLint: for Unix/Linux
8. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
8/47
What is Lint/PC-lint?
PC-lint
► Works similar to a compiler
► Checks code statically ('at compile-time')
► Doesn't produce machine code
► Performs thousands of checks and will produce the appropriate
warnings, so-called "issues" or "messages
9. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
9/47
Examples
Let's have a look at some code...
10. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
10/47
What's wrong with this C code?
1 #include <stdio.h>
2 #define SUM(x, y) (x) + (y)
3 unsigned long* PerformGizmoAlgorithm(int a, int b) {
4 unsigned long vector[8] = {143, 33, 2l, 76, 83, 222, 45, 45};
5 int i;
6
7 for (i = 0; i < 8; ++i);
8 vector[i + 1] = vector[i] * SUM(a, b);
9
10 return vector;
11 }
11. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
11/47
What's wrong with this C code?
1 #include <stdio.h>
2 #define SUM(x, y) (x) + (y)
3 unsigned long* PerformGizmoAlgorithm(int a, int b) {
4 unsigned long vector[8] = {143, 33, 2l, 76, 83, 222, 45, 45};
5 int i;
6
7 for (i = 0; i < 8; ++i);
8 vector[i + 1] = vector[i] * SUM(a, b);
9
10 return vector;
11 }
file.c:2 I 773 Expression-like macro 'SUM' not parenthesized
file.c:7 I 722 Suspicious use of ;
file.c:8 W 539 Did not expect positive indentation from line 7
file.c:8 I 737 Loss of sign in promotion from int to unsigned long
file.c:8 W 661 Possible access of out-of-bounds pointer (1 beyond end of data) by operator '['
file.c:8 W 661 Possible access of out-of-bounds pointer (2 beyond end of data) by operator '['
file.c:10 W 604 Returning address of auto variable 'vector'
file.c:0 I 766 Header file '/usr/include/stdio.h' not used in module 'file.c'
file.c:4 W 620 Suspicious constant (L or one?)
Would you have
found all of these
issues?
12. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
12/47
What's wrong with this C++ code?
1 class Base {
2 char* mp;
3 int mCount;
4 public:
5 Base(int aCount = 0) { mCount = aCount; if(mCount > 0) mp = new char[mCount]; }
6 void printRuntimeType() { cout << "Base"; }
7 ~Base() { delete mp; }
8 };
9
10 class Derived : public Base {
11 public:
12 void printRuntimeType() { cout << "Derived"; }
13 };
13. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
13/47
What's wrong with this C++ code?
1 class Base {
2 char* mp;
3 int mCount;
4 public:
5 Base(int aCount = 0) { mCount = aCount; if(mCount > 0) mp = new char[mCount]; }
6 void printRuntimeType() { cout << "Base"; }
7 ~Base() { delete mp; }
8 };
9
10 class Derived : public Base {
11 public:
12 void printRuntimeType() { cout << "Derived"; }
13 };
file.cpp:5 I 1732 new in constructor for class Base which has no assignment operator
file.cpp:5 I 1733 new in constructor for class Base which has no copy constructor
file.cpp:5 I 737 Loss of sign in promotion from int to unsigned int
file.cpp:5 W 1541 Member Base::mp (line 4) possibly not initialized by constructor
file.cpp:7 W 424 Inappropriate deallocation (delete) for 'new[]' data.
file.cpp:12 W 1511 Member hides non-virtual member Base::printRuntimeType(void) (line 8)
file.cpp:13 W 1509 base class destructor for class 'Base' is not virtual
Would you have
found all of these
issues?
14. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
14/47
What PC-lint is Not
Focus is on finding C/C++ programming errors:
► No: Java, C#
► No: Metrics
► No: High-level design and architectural analysis
Inexpensive, compact but powerful code checker:
► No: GUI/browsers/wizards
► No: Issue database
► No: License server
15. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
15/47
Features
A quick tour of some features
► Weak definials
► Const-correctness
► Strong types
► Value tracking
► Semantics
► Multi-thread support
► Author files and MISRA
16. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
16/47
Weak definials
PC-lint keeps code (esp. interfaces) clean by reporting
► Unused declarations (types, macros...)
► Unused or redundantly included headers
► Declarations that are only used locally
►
Move from header to .c/.cpp file
►
Make functions/objects static
17. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
17/47
Const-correctness
Const-correctness is an important topic in C/C++
Difficult to add const-correctness later (ripple effect)
PC-lint reports:
► Member function could be made const
► Pointer could be declared as pointing to const
► Even: parameters/objects could be made const
18. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
18/47
Strong types
Neither C nor C++ has strong typing
► Mixing enums, ints, bools, typedefs is permissible
'Strong type' feature lets you selectively enable strong type
checking
typedef int Temperature;
int t1 = 42;
Temperature t2 = t1; // Bad!
if (t1) { // Bad!
...
}
Compatibility of types can be achieved through the 'type
hierarchy' feature
19. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
19/47
Value tracking
PC-lint keeps track of variable values and initialization status:
extern int g_array[10];
int foo(int* arr, int n) { return arr[n]; }
...
if (count == 20) {
cout << "Wow, 20 elements!" << endl;
}
int y = foo(g_array, 20); // -passes(2): likely out-of-bounds access
int x = foo(g_array, count); // -passes(2): possible out-of-bounds access
The more passes, the better (but slower!)
20. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
20/47
Many well-known library functions have certain pre-/postconditions:
► assert(), abort(): never return
► memset(): arg3 may not exceed sizeof arg1 area
► strcpy(): return value is never NULL
► fopen(): args never NULL and '0' terminated; return value may be NULL
Transfer such well-known semantics to user-defined functions
► -function(abort, MyClass::stop)
PC-lint uses additional information during analysis
mc->stop();
foo(42); // Unreachable code!
Semantics -- function mimicry
21. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
21/47
Semantics -- semantic specifications
Function mimicry is based on "semantic specifications"
Use semantic specifications for finer-grained control
Many, many possibilities via -sem option:
r_null, r_no, nulterm(#), #p, inout, thread, thread_unsafe...
Example:
//lint -sem(decode, inout(3))
result_t decode(const void* src, void* dest, int* destLen);
void foo() {
int n;
if (decode(inbuf, outbuf, &n) == OK) { // n not initialized
...
}
}
22. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
22/47
Based on "semantic specifications", specify:
► Thread root functions
► Thread creation functions (eg. pthread_create())
► Begin of thread protected region (eg. pthread_mutex_lock)
► End of thread protected region (eg. pthread_mutex_unlock)
► Thread-safe, thread-unsafe functions
PC-lint reports:
► Unprotected access to static/global data/objects
► Unprotected calls to thread-unsafe functions
► Mismatched lock/unlock calls
Multi-thread support
23. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
23/47
Option files with checks recommended by authors:
► Mainly Scott Meyers, "(More) Effective C++" (au-sm*.lnt)
► Checks for 64-bit issues (au-64.lnt)
► MISRA recommendations:
► MISRA C 1998 (au-misra1.lnt)
► MISRA C 2004 (au-misra2.lnt)
► MISRA C 2012 (au-misra3.lnt)
► MISRA C++ (au-misra-cpp.lnt)
Author files and MISRA
24. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
24/47
Usage
Usage
► Command-line interface
► Lint messages
► Lint policy
► Message inhibition
25. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
25/47
Command-line interface
lint-nt.exe <args>... <files>...
► lint-nt.exe -w3 -I../include main.cpp calc.cpp
Pass options directly or via option file (*.lnt)
► lint-nt.exe settings.lnt main.cpp calc.cpp
► lint-nt.exe settings.lnt files.lnt
Two modes of operation
► Single checkout mode (-u)
►
lint-nt.exe settings.lnt -u calc.cpp
►
Good for quick checks of a single module
► Whole-project mode (w/o -u)
►
Slower, but Lint analysis is much deeper
►
PC-lint knows if and how functions/identifiers are used across translation units
26. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
26/47
Command-line interface
PC-lint output
► Can be tuned
► "Message presentation options" define what and how issues are
reported
► Call PC-lint from within your favorite editor/IDE to navigate code/issues
► Select env-*.lnt files that match your IDE's error parser, e. g.
env-vc9.lnt, env-vim.lnt, env-xml.lnt, env-html.lnt
27. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
27/47
Lint messages
Lint produces around 1000 different warnings
Let's review our previous example...
Kind C C++ Level Think...
Syntax Errors 1 - 199 1001 - 1199 1 Syntax Error
Internal Errors 200 - 299 1200 - 1299 Oops!
Fatal Errors 300 - 399 Oops!
Warnings 400 - 699 1400 - 1699 2 Something likely wrong
Informational 700 - 899 1700 - 1899 3 Something might be wrong
Elective Notes 900 - 999 1900 - 1999 4 Style issue
28. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
28/47
What's wrong with this C code?
1 #include <stdio.h>
2 #define SUM(x, y) (x) + (y)
3 unsigned long* PerformGizmoAlgorithm(int a, int b) {
4 unsigned long vector[8] = {143, 33, 2l, 76, 83, 222, 45, 45};
5 int i;
6
7 for (i = 0; i < 8; ++i);
8 vector[i + 1] = vector[i] * SUM(a, b);
9
10 return vector;
11 }
file.c:2 I 773 Expression-like macro 'SUM' not parenthesized
file.c:7 I 722 Suspicious use of ;
file.c:8 W 539 Did not expect positive indentation from line 7
file.c:8 I 737 Loss of sign in promotion from int to unsigned long
file.c:8 W 661 Possible access of out-of-bounds pointer (1 beyond end of data) by operator '['
file.c:8 W 661 Possible access of out-of-bounds pointer (2 beyond end of data) by operator '['
file.c:10 W 604 Returning address of auto variable 'vector'
file.c:0 I 766 Header file '/usr/include/stdio.h' not used in module 'file.c'
file.c:4 W 620 Suspicious constant (L or one?)
Some 'informationals'
are clearly bugs
in this context!
29. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
29/47
Enabling/disabling messages
Coarse level: -w<level> option
► Example: -w3 // Set warning level to 3.
Fine level: [+-]e<number>
► Example: +e1509 // Warn on non-virtual base class d-tor.
► Example: -e801 // Using 'goto' is fine.
“User Lint Policy” defines the right mix...
30. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
30/47
User Lint policy
The user Lint policy...
► is a text file containing global PC-lint settings for a project
► is fed to PC-lint during a Lint run
► mostly consists of message-related settings
► base warning level (e. g. 3) plus/minus many exceptions
► is not cast in stone but evolves over time
► allows for local overriding of settings in source files
31. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
31/47
Lint policy example
-function(__assert, ASSERT) // copy semantics of assert()
-strong(b,boolean) // BOOLEAN is of type boolean
+macros // enable long lines
-wlib(1) // in lib headers report only errors
-w3 // warning level 3
-A // strict ANSI
+fpn // argument pointers might be NULL
-esym(534,*printf) // often called without checking return
-esym(534,*strncat,*strncpy) // often called without checking return
-esym(534,*strcpy) // often called without checking return
-epn // nominally differing ptrs
-e787 // non-exhaustive switch
-e788 // non-exhaustive switch
-e508 // extern with definition
-e641 // enum to int conversion
-e730 // boolean arg to function
-e46 // fields other than int
-e655 // bit-wise operator used with enums
-"esym(793, external identifiers)" // don't complain about more than 511 external
...
32. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
32/47
Message inhibition
How to get rid of unwanted messages:
► Fully understand what PC-lint is saying (consult msg.txt)
► Modify the code (carefully!)
► Fix indentation
► Parenthesize
►
Use assertions
► cast
► Suppress locally via inhibition comments
(next slide)
► Last resort: #ifdef _lint
► Consider making (suggesting) changes to the Lint Policy
33. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
33/47
Inhibition within source code
Options within Lint comments:
► within source code: /*lint ... */ or //lint ...
► Note! No blank before 'lint' keyword!
//lint -e{888} hollyr: Needed for performance optimization
x = foo() * bar() - a;
Various variants exist that limit the scope of an inhibition
34. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
34/47
Inhibition comments
Next expression suppression:
a = /*lint -e(413) dereferencing 0 is OK */ *(char*)0);
One-line suppression:
if (x = f(34)) //lint !e720 boolean test of assignment is OK
y = y / x;
Within-a-macro suppression:
//lint -emacro(732, MULTIPLY) suppress loss of sign for macro MULTIPLY
Suppression for a particular symbol:
//lint -esym(754, MyClass::foo) suppress 'foo' not referenced
There are many, many more (see chapter 5.2 of PC-lint manual)
Advice: always use the narrowest inhibition scope possible!
35. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
35/47
The true value of PC-lint
Q: What's the purpose of using PC-lint?
A: Find bugs, of course!
36. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
36/47
When to use PC-lint?
1. Check-out
2. Coding
3. Developer testing
4. Check-in
5. Nightly/daily build
6. Integration testing
7. System testing
8. Release
here!
38. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
38/47
When linting late in the life-cycle
Code has already been tested and debugged
► Lots of effort has been spent (wasted) already
► Mostly only “false positives” left
Big mental distance
► Hard to remember the change
► Reluctance to change existing (working) code
►
Fear of introducing real bugs
►
Pride!
Developers often blindly dismiss warnings as “false positives”
39. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
39/47
When linting early in the life-cycle
Less time wasted on debugging
PC-lint acts as a coach
► Reviews code, criticizes
►
“software consciousness”
► Teaches C/C++ best practices
►
Over time, developers become better developers
PC-lint encourages developers to review their own code
► Often, even unrelated problems are found
Low mental distance
Low pride
Code is cleaned-up, rewritten, quality increased
40. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
40/47
How many lint warnings are acceptable?
0
41. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
41/47
“Zero Warnings” process
No warnings allowed when checking-in code
No “can't see the forest for the trees” effects
► Developers see only their issues
No tracking of PC-lint issues
► Management-free
No mental distance
► Issues must be resolved, now!
42. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
42/47
The true value of PC-lint
Q: What's the purpose of using PC-lint?
A: Prevent bugs and keep technical debt low!
This is Ward Cunningham,
inventor of the technical
debt metaphor.
My hero!
43. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
43/47
False positives
“In previously unlinted code, you may get a
discouragingly large number of messages”
The PC-lint Manual
44. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
44/47
False positives
1 #define ADD(x, y) x + y
2 #define MUL(x, y) x * y
3
4 class Base {
5 public:
6 Base(int i) : _i(i) { }
7 int add(int a, int b) { return ADD(a, b); }
8 ~Base() { /* ... */ }
9 private:
10 int _i;
11 };
12
13 class Derived : public Base {
14 };
false_positives.cpp:1 Info 773: Expression-like macro 'ADD' not parenthesized
false_positives.cpp:2 Info 773: Expression-like macro 'MUL' not parenthesized
false_positives.cpp:6 Note 1931: Constructor 'Base::Base(int)' can be used for implicit conversions
false_positives.cpp:7 Info 1762: Member function 'Base::add(int, int)' could be made const
false_positives.cpp:4 Info 1712: default constructor not defined for class 'Base'
false_positives.cpp:4 Info 1790: Base class 'Base' has no non-destructor virtual functions
false_positives.cpp:8 Warning 1509: base class destructor for class 'Base' is not virtual
false_positives.cpp:8 Warning 1512: destructor for base class 'Base' is not virtual
false_positives.cpp:2 Info 750: local macro 'MUL' not referenced
45. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
45/47
False positives
Based on the wrong notion about PC-lint
► Confusing “preventing” bugs with “finding” bugs
Almost every Lint warning is valuable
► Highlights technical debt
► If PC-lint has difficulties understanding code, another developer might
have as well
► Prevents future problems
► Self-reviews
46. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
46/47
Some final thoughts...
PC-lint is more about preventing bugs than about finding bugs
Not a magic weapon but another step towards higher quality
Use PC-lint as early as possible in your life-cycle
Try hard to understand what PC-lint is trying to say
Prefer rewriting code over suppression comments
Keep the number of warnings at all times at zero
PC-lint is your friend, not your enemy!
47. An Introduction to PC-lint Licensed under CC BY-NC-ND 3.0 by Ralf Holly Software Consulting
47/47
License
This presentation is licensed under the terms of the
Creative Commons - Attribution - Non Commercial - No Derivatives license.
See http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode for details.