Lint (software)

Last updated
Lint
Original author(s) Stephen C. Johnson
Developer(s) AT&T Bell Laboratories
Initial releaseJuly 26, 1978;45 years ago (1978-07-26) [1]
Written in C
Operating system Cross-platform
Available inEnglish
Type Static program analysis tools
License Originally proprietary commercial software, now free software under a BSD-like license [2] [3]

Lint is the computer science term for a static code analysis tool used to flag programming errors, bugs, stylistic errors and suspicious constructs. [4] The term originates from a Unix utility that examined C language source code. [1] A program which performs this function is also known as a "linter".

Contents

History

Stephen C. Johnson, a computer scientist at Bell Labs, came up with the term "lint" in 1978 while debugging the yacc grammar he was writing for C and dealing with portability issues stemming from porting Unix to a 32-bit machine. [5] [1] The term was borrowed from the word lint, the tiny bits of fiber and fluff shed by clothing, as the command he wrote would act like a lint trap in a clothes dryer, capturing waste fibers while leaving whole fabrics intact. In 1979, lint programming was used outside of Bell Labs for the first time, in the seventh version (V7) of Unix.

Over the years, different versions of lint have been developed for many C and C++ compilers, and while modern-day compilers have lint-like functions, lint-like tools have also advanced their capabilities. For example, Gimpel's PC-Lint, introduced in 1985 and used to analyze C++ source code, is still for sale. [5]

Overview

In his original 1978 paper Johnson stated his reasoning in creating a separate program to detect errors, distinct from that which it analyzed: "...the general notion of having two programs is a good one" [because they concentrate on different things, thereby allowing the programmer to] "concentrate at one stage of the programming process solely on the algorithms, data structures, and correctness of the program, and then later retrofit, with the aid of lint, the desirable properties of universality and portability". [1]

Successor linters

The analysis performed by lint-like tools can also be performed by an optimizing compiler, which aims to generate faster code. Even though modern compilers have evolved to include many of lint's historical functions, lint-like tools have also evolved to detect an even wider variety of suspicious constructs. These include "warnings about syntax errors, uses of undeclared variables, calls to deprecated functions, spacing and formatting conventions, misuse of scope, implicit fallthrough in switch statements, missing license headers, [and]...dangerous language features". [6]

Lint-like tools are especially useful for dynamically typed languages like JavaScript and Python. Because the compilers of such languages typically do not enforce as many and as strict rules prior to execution, linter tools can also be used as simple debuggers for finding common errors (e.g. syntactic discrepancies) as well as hard-to-find errors such as heisenbugs (drawing attention to suspicious code as "possible errors"). [7] Lint-like tools generally perform static analysis of source code. [8]

Lint-like tools have also been developed for other aspects of software development: enforcing grammar and style guides for given language source code.[ citation needed ]

See also

Related Research Articles

In computing, a compiler is a computer program that translates computer code written in one programming language into another language. The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a low-level programming language to create an executable program.

C is a general-purpose computer programming language. It was created in the 1970s by Dennis Ritchie, and remains very widely used and influential. By design, C's features cleanly reflect the capabilities of the targeted CPUs. It has found lasting use in operating systems, device drivers, and protocol stacks, but its use in application software has been decreasing. C is commonly used on computer architectures that range from the largest supercomputers to the smallest microcontrollers and embedded systems.

An integrated development environment (IDE) is a software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, and a debugger. Some IDEs, such as IntelliJ IDEA, Eclipse and Lazarus contain the necessary compiler, interpreter or both; others, such as SharpDevelop, NetBeans do not.

Yacc is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a lookahead left-to-right rightmost derivation (LALR) parser generator, generating a LALR parser based on a formal grammar, written in a notation similar to Backus–Naur form (BNF). Yacc is supplied as a standard utility on BSD and AT&T Unix. GNU-based Linux distributions include Bison, a forward-compatible Yacc replacement.

<span class="mw-page-title-main">Bourne shell</span> Command-line interpreter for operating systems

The Bourne shell (sh) is a shell command-line interpreter for computer operating systems.

In software development, Make is a build automation tool that builds executable programs and libraries from source code by reading files called makefiles which specify how to derive the target program. Though integrated development environments and language-specific compiler features can also be used to manage a build process, Make remains widely used, especially in Unix and Unix-like operating systems.

The C standard library or libc is the standard library for the C programming language, as specified in the ISO C standard. Starting from the original ANSI C standard, it was developed at the same time as the C library POSIX specification, which is a superset of it. Since ANSI C was adopted by the International Organization for Standardization, the C standard library is also called the ISO C library.

A programming tool or software development tool is a computer program that software developers use to create, debug, maintain, or otherwise support other programs and applications. The term usually refers to relatively simple programs, that can be combined to accomplish a task, much as one might use multiple hands to fix a physical object. The most basic tools are a source code editor and a compiler or interpreter, which are used ubiquitously and continuously. Other tools are used more or less depending on the language, development methodology, and individual engineer, often used for a discrete task, like a debugger or profiler. Tools may be discrete programs, executed separately – often from the command line – or may be parts of a single large program, called an integrated development environment (IDE). In many cases, particularly for simpler use, simple ad hoc techniques are used instead of a tool, such as print debugging instead of using a debugger, manual timing instead of a profiler, or tracking bugs in a text file or spreadsheet instead of a bug tracking system.

C dynamic memory allocation refers to performing manual memory management for dynamic memory allocation in the C programming language via a group of functions in the C standard library, namely malloc, realloc, calloc, aligned_alloc and free.

<span class="mw-page-title-main">Valgrind</span> Programming tool for profiling, memory debugging and memory leak detection

Valgrind is a programming tool for memory debugging, memory leak detection, and profiling.

Source Code Control System (SCCS) is a version control system designed to track changes in source code and other text files during the development of a piece of software. This allows the user to retrieve any of the previous versions of the original source code and the changes which are stored. It was originally developed at Bell Labs beginning in late 1972 by Marc Rochkind for an IBM System/370 computer running OS/360.

Stephen Curtis Johnson is a computer scientist who worked at Bell Labs and AT&T for nearly 20 years. He is best known for Yacc, Lint, spell, and the Portable C Compiler, which contributed to the spread of Unix and C. He has also contributed to fields as diverse as computer music, psychometrics and VLSI design.

<span class="mw-page-title-main">History of Unix</span>

The history of Unix dates back to the mid-1960s, when the Massachusetts Institute of Technology, AT&T Bell Labs, and General Electric were jointly developing an experimental time-sharing operating system called Multics for the GE-645 mainframe. Multics introduced many innovations, but also had many problems. Bell Labs, frustrated by the size and complexity of Multics but not its aims, slowly pulled out of the project. Their last researchers to leave Multics – among them Ken Thompson, Dennis Ritchie, Doug McIlroy, and Joe Ossanna – decided to redo the work, but on a much smaller scale.

<span class="mw-page-title-main">Mathomatic</span> Computer algebra system

Mathomatic is a free, portable, general-purpose computer algebra system (CAS) that can symbolically solve, simplify, combine, and compare algebraic equations, and can perform complex number, modular, and polynomial arithmetic, along with standard arithmetic. It does some symbolic calculus (derivative, extrema, Taylor series, and polynomial integration and Laplace transforms), numerical integration, and handles all elementary algebra except logarithms. Trigonometric functions can be entered and manipulated using complex exponentials, with the GNU m4 preprocessor. Not currently implemented are general functions like f(x), arbitrary-precision and interval arithmetic, and matrices.

The Portable C Compiler is an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in the mid-1970s, based in part on ideas proposed by Alan Snyder in 1973, and "distributed as the C compiler by Bell Labs... with the blessing of Dennis Ritchie."

<span class="mw-page-title-main">Unix</span> Family of computer operating systems

Unix is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.

PC-lint is a commercial software linting tool produced by Gimpel Software for the C/C++ languages.

In computer programming and software development, debugging is the process of finding and resolving bugs within computer programs, software, or systems.

<span class="mw-page-title-main">CudaText</span> Open source text editor

CudaText, from Bosnian-Croatian-Montenegrin-Serbian čuda, is a free open source cross-platform native GUI text and source code editor. CudaText supersedes its predecessor SynWrite, no longer under development.

References

  1. 1 2 3 4 Johnson, Stephen C. (25 October 1978). "Lint, a C Program Checker". Comp. Sci. Tech. Rep. Bell Labs: 78–1273. CiteSeerX   10.1.1.56.1841 . Archived from the original on 2022-01-23.
  2. "UNIX is free!". lemis.com. 2002-01-24.
  3. Broderick, Bill (January 23, 2002). "Dear Unix enthusiasts" (PDF). Caldera International. Archived from the original (PDF) on February 19, 2009.
  4. "About SublimeLinter". The SublimeLinter Community, revision 1cecc79c. Retrieved 2020-03-29.
  5. 1 2 Morris, Richard (1 October 2009). "Stephen Curtis Johnson: Geek of the Week". Red Gate Software. Retrieved 19 January 2018.
  6. "Arcanist User Guide: Lint". Phabricator. Retrieved 19 January 2018.
  7. "ESLint - Customizable JavaScript linting tool (1)". theCodeCampus. 2015-06-09. Retrieved 2019-04-21.
  8. Jones, Nigel (1 May 2002). "How to Use Lint for Static Code Analysis". Barr Group.

Further reading