ArticleslgStudy

computer science

Portable C Compiler

Portable C Compiler is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Portable C Compiler rather than just read about it. In short: The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) 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." Being one of the first compilers that could easily be adapted to outp…

Key takeaways

  • Portable C Compiler belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Portable C Compiler to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Portable C Compiler from memory before moving on to harder problems.

Reference excerpt

The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) 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." Being one of the first compilers that could easily be adapted to output code for different computer architectures, the compiler had a long life span. It debuted in Seventh Edition Unix and shipped with BSD Unix until the release of 4.4BSD in 1994, when it was replaced by the GNU C Compiler. It was very influential in its day, so much so that at the beginning of the 1980s, the majority of C compilers were based on it. Anders Magnusson and Peter A Jonsson restarted development of pcc in 2007, rewriting it extensively to support the C99 standard.

Features Key features of PCC are its portability and improved diagnostic capabilities. The compiler was designed so that only a few of its source files are machine-dependent. It is relatively robust to syntax errors and performs more thorough validity checks than its contemporaries. The first C compiler, written by Dennis Ritchie, used a recursive descent parser, incorporated specific knowledge about the PDP-11, and relied on an optional machine-specific optimizer to improve the assembly language code it generated. In contrast, Johnson's pccm was based on a yacc-generated parser and used a more general target machine model. Both compilers produced target-specific assembly language code which they then assembled to produce linkable object modules. Later versions of PCC, known within Bell Labs as "QCC" and "RCC," supported other target architecture models. The language that PCC implements is an extended version of K&R C that Bjarne Stroustrup has called "Classic C", incorporating the void return type (for functions that don't return any value), enumerations and structure assignment.

Current version A new version of PCC, based on the original by Steve Johnson, is maintained by Anders Magnusson. The compiler is provided under the BSD licence and its development is funded by a non-profit organization called BSD Fund. According to Magnusson:

The big benefit of it (apart from that it's BSD licensed, for license geeks) is that it is fast, 5-10 times faster than gcc, while still producing reasonable code. <...> [I]t is also quite simple to port... This new version was added to the NetBSD pkgsrc and OpenBSD source trees in September 2007, and later into the main NetBSD source tree. There had been some speculation that it might eventually be used to supplant the GNU C Compiler on BSD-based operating systems, though FreeBSD and NetBSD are both looking to Clang as a potential replacement, and Theo de Raadt of OpenBSD asserts that pcc is not ready yet to be a gcc replacement, and the disposal of gcc is not top priority. On December 29, 2009, pcc became capable of building a functional x86 OpenBSD kernel image. pcc version 1.0 was released on 1 April 2011. As of this release, the compiler supports x86 and x86-64 processor architectures and runs on NetBSD, OpenBSD, FreeBSD, various Linux distributions, and Microsoft Windows. Further development, including support for more architectures, and FORTRAN 77 and C++ front ends, is continuing as of 2022. PCC was removed from the OpenBSD source tree in 2012. Development on it had stalled and no maintainer had stepped up to develop it into something that could make a practical alternative to GNU Compiler Collection. The latest version of pcc, namely 1.1.0, was released on 10 December 2014.

See also

Amsterdam Compiler Kit Clang Open Watcom

References

External links Archive at TUHS GitHub repository with a copy of the original sources Another GitHub repository with more up-to-date sources

Worked examples

Example 1 — a first encounter with Portable C Compiler

Start with the simplest possible case. Write down what Portable C Compiler claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Portable C Compiler before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Portable C Compiler ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Portable C Compiler

In research
Portable C Compiler appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Portable C Compiler in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Portable C Compiler is common in secondary-school and first-year university syllabi. It links to neighbouring topics C (programming language) compilers, Free and open source compilers, NetBSD, so understanding it makes those chapters shorter.
In everyday life
Look for Portable C Compiler outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Portable C Compiler” →

How to study Portable C Compiler in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Portable C Compiler means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Portable C Compiler out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Portable C Compiler in simple terms?

The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) 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…

Why does Portable C Compiler matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Portable C Compiler?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Portable C Compiler.

Tags

  • C (programming language) compilers
  • Free and open source compilers
  • NetBSD
  • OpenBSD
  • Software using the BSD license

Keep exploring