C: Difference between revisions
m →Implementations that run under WinOS/2: branched |
mNo edit summary |
||
Line 1: | Line 1: | ||
[[Image:The_C_Programming_Language.png|right|160px]] | [[Image:The_C_Programming_Language.png|right|160px]] | ||
The programming language '''C''' is a weakly typed imperative language in the [[CPL]] branch of the [[Algol]] family of programming languages. It's the one of the more popular programming language after [[Java]] and that alongside its widespread use as a systems language has meant that most C development systems available have seen a lot of maintenance and are therefore in a relatively good standing when it comes to support for modern CPU architectures and systems vis a vis some other languages. | |||
==History== | |||
A direct descendant of [[BCPL]] although it uses a very different syntax. | |||
Later developments are [[C++]], [[Objective C]] and D. | |||
==Features== | |||
C is often erroneously described as being "closer to the hardware" than other languages, and this is used to explain why it is faster and less portable than "language x". In fact C is no closer or further from the metal than any other similar language in the Algol branch, no more or less portable and no faster or slower either. What C is however is a ''systems language'' much like [[PL/I]], i.e. it is designed from the outset to be able to program any function that a computer system requires and therefore provides a number of low level functions that are designed to aid in systems programming but are not necessarily useful in day to day programming. | C is often erroneously described as being "closer to the hardware" than other languages, and this is used to explain why it is faster and less portable than "language x". In fact C is no closer or further from the metal than any other similar language in the Algol branch, no more or less portable and no faster or slower either. What C is however is a ''systems language'' much like [[PL/I]], i.e. it is designed from the outset to be able to program any function that a computer system requires and therefore provides a number of low level functions that are designed to aid in systems programming but are not necessarily useful in day to day programming. | ||
This is in contrast to a number of other languages like [[Pascal]] that are ''domain specific'' or in other words are designed to perform well inside a specific functionality domain. This includes application, simulation, scripting or teaching languages | This is in contrast to a number of other languages like [[Pascal]] that are ''domain specific'' or in other words are designed to perform well inside a specific functionality domain. This includes application, simulation, scripting or teaching languages, and these are not or were not originally meant to be used to write systems software with. Although you can coax them to do so in many cases or extend them to encapsulate functions needed for systems software. | ||
But even though C was designed from the outset as a systems language it does have some peculiar deficiencies that have never been fixed altogether | But even though C was designed from the outset as a systems language it does have some peculiar deficiencies that have never been fixed altogether. It is slower than most other Algol family languages in doing I/O, to a point where even interpreted versions of Pascal and [[Basic]] can be considerably faster performing I/O than compiled C code. For this reason C has never really caught on as a programming language on mainframes and most minicomputer systems to the degree it has on PCs and [[UNIX]] systems, especially if they have registered I/O and file systems. Those systems rely to a much higher degree on throughput than processing power vis-a-vis PCs and workstations, so languages like [[FORTRAN]] and [[PL/I]] have tended to survive in those environments. | ||
==Implementations== | ==Implementations== |
Revision as of 23:23, 29 November 2018

The programming language C is a weakly typed imperative language in the CPL branch of the Algol family of programming languages. It's the one of the more popular programming language after Java and that alongside its widespread use as a systems language has meant that most C development systems available have seen a lot of maintenance and are therefore in a relatively good standing when it comes to support for modern CPU architectures and systems vis a vis some other languages.
History
A direct descendant of BCPL although it uses a very different syntax. Later developments are C++, Objective C and D.
Features
C is often erroneously described as being "closer to the hardware" than other languages, and this is used to explain why it is faster and less portable than "language x". In fact C is no closer or further from the metal than any other similar language in the Algol branch, no more or less portable and no faster or slower either. What C is however is a systems language much like PL/I, i.e. it is designed from the outset to be able to program any function that a computer system requires and therefore provides a number of low level functions that are designed to aid in systems programming but are not necessarily useful in day to day programming.
This is in contrast to a number of other languages like Pascal that are domain specific or in other words are designed to perform well inside a specific functionality domain. This includes application, simulation, scripting or teaching languages, and these are not or were not originally meant to be used to write systems software with. Although you can coax them to do so in many cases or extend them to encapsulate functions needed for systems software.
But even though C was designed from the outset as a systems language it does have some peculiar deficiencies that have never been fixed altogether. It is slower than most other Algol family languages in doing I/O, to a point where even interpreted versions of Pascal and Basic can be considerably faster performing I/O than compiled C code. For this reason C has never really caught on as a programming language on mainframes and most minicomputer systems to the degree it has on PCs and UNIX systems, especially if they have registered I/O and file systems. Those systems rely to a much higher degree on throughput than processing power vis-a-vis PCs and workstations, so languages like FORTRAN and PL/I have tended to survive in those environments.
Implementations
OS/2 1.x
Hosted language implementations that produce OS/2 16-bit object code
OS/2 2.x
Hosted Language implementations that produce OS/2 32-bit object code
- Borland C++ (1993-1996)
- FSF GNU Compiler Collection (GCC) (Open Source)
- GCC/2
- emx GCC
- Innotek GCC
- IBM C Set/2
- IBM C Set++ for OS/2
- IBM IBM VisualAge C++
- Metaware High C/C++ - also used for OS/2 PowerPC ELF
- Microway NDP C
- OpenWatcom C/C++ (Open Source)
- Symantec Zortech C++ (1992-1993)
- Watcom C/386
There was also a port of Comeau C++ 3.x that was functional but never released as a product, although a few examples got released into the wild.
Interpreter
- Cint - Interpreter from CERN, intended for educational use
C libraries
If the compiler you use supports both C and C++, you can use C libraries with your C++ programs and vice versa, however using C++ libraries from C can be a bit kludgey and can require you to write bindings, while using C libraries with C++ is less problematic it can also require you to write some interfaces, take a look at the C++ for available libraries.
Text UI libraries
- Open source
- nCurses - Text UI library
- Public Domain Curses - Text UI library
- Commercial
- C-scape Interface Management System - Screen painter and UI library
- Greenleaf Data Windows - Text mode windows & UI
- Neuron Data Open Interface - Screen painter/UI toolkit
- Panel Plus II - Screen painter and UI library
Graphics libraries
- Open source
- Cairo - 2D graphics library
- Jpeglib - Read/write JPEG graphic files
- Libpng - Read/write PNG files
- SVGA-Kit and VESA-EMX - Graphic libraries
- Pixman - Low level graphics library
- Simple Directmedia Layer - Multimedia
- WebM libvpx - VP8/VP9 streaming video
- Commercial
- IBM SAA Common User Access Controls Library/2
- XVT - Screen painter and UI library
Database libraries
- Commercial
- C/Database Toolchest - Database creation and maintenance
- dbfLIB - xBase database library
- e_Db - Database engine
- Lattice dBC III - xBase database library
- Open Source
- libdbf - reads dbf files
Other libraries
- Open Source
- Andy's Dynamic Link Library - Cross platform DLLs
- cstring - String manipulation
- CUtil - Common OS/2 functions
- Eco Common Lisp - Embedded scripting language
- FFTW - Fast Fourier Transforms
- libcURL Internet communications library
- Libxml2 - XML parser
- Libxslt - XSLT parser
- LZO - Compression library
- LZ4 - Compression library
- OpenSSL - SSL & encryption
- POSIX Pthreads - BSD Pthreads library
- Public Domain Project C Library - Alternative CLIB
- shwild - Wildcard pattern matching
- S-Lang - Embeddable macro/script language
- Snappy - Compression library
- The Standard Function Library - Generic library
- Commercial
- e_Comm - Communications and networking
- e_Fs - Virtual file system
- Lattice Comm Library - ANSI C communication library
- LC-Port - Lattice C porting library
C source code snippets, archives and collections
Small programs or routines that you can integrate into your own programs or study to learn from, but are not delivered in library form.
- Open source
- PDCRC - CRC routines in C
- OS/2 Primecuts - OS/2 API Examples
- OZPD - Sundry C routines and programs
- Small examples of Workplace Shell programming
GUI and application generators with C output
- Commercial
- General Application Workbench - GUI, animation, help and SQL
- Hockware VisPro/C - GUI Creator
- Intersolv GA Workbench
- Panel Plus II - Screen painter and UI library
- PCYACC/2 - CASE too with C output, targeted towards generating parsers etc.
- Vestronix Pro C - Database and spreadsheet application generator
Translators that generate C output
- The APL c compiler project
- flex - Scanner generator - Open source
- M2CC/C Modula-2 > C - Commercial
- Oracle Pro*C - SQL > C - Commercial
- X2C - xBase to C compiler
C Source Code Utilities
- CC-Rider C++ - Commercial - Static analyser, beautifier and visualiser.
- DOC++ - Automatic document generator - Open source
- Ephedra - C/C++ to Java - Open source
- Exuberant ctags - Creates index files out of C source files
- SourceLink - Commercial - Browser/Editor/Visualiser
- Source Mapper - Open source - Visualiser
- Static analyser
- PC-Lint
- Splint
Editor support
- Boxer - C support included by default
- BRIEF - C support included by default
- Elvis - C syntax support included by default
- Enhanced Editor - Has syntax highlighting, auto-formatting and automatic code summary for C.
- FTE - Has support for syntax highlighting, code folding and syntax-aware auto-indent.
- Lugaru Epsilon - C syntax highlighting, code folding and syntax-aware auto-indent
- NEdit - XFree86 - Auto-indent, autocomplete and syntax highlighting
- Preditor/2 - C template with syntax highlighting
- SourceLink - Browser/Editor/Visualiser
Applications with a C programming interface
- PostgreSQL - SQL relational database system.
C like scripting languages
Note that this does not include full interpreters like Cint, but either languages squarely intended to be scripted and/or embeddable interpreters.
- CEnvi - Shareware - Predecessor to ScriptEase (below).
- C Scripting Language
- C Styled Script - Open source
- ScriptEase - Commercial
Publications
- Nabajyoti Barkakati: Microsoft C Bible - SAMS 1988 - Applies to Microsoft C 5.1, but also contains some other useful info.
- The Journal of C Language Translation - Magazine on advanced C topics, published from 1989 to 1993, freely downloadable in a PDF format.
- Anthony S. Rudd: C. for Non-C Programmers - 1993 - John Wiley & Sons - ISBN 089435468X
- Anthony S. Rudd: Mastering C - 1994 - Wiley/QED, ISBN 0-471-60820-3
- Kris Jamsa: The Quick Reference Guide to C. Run-time Library - Microsoft Press 1989, ISBN 1-55615-227-2
- Kris Jamsa: The C Library - Osborne/McGraw-Hill 1985, ISBN 0-07-881110-4
- Not as you might think a discussion of the Microsoft C library, but rather a collection of C routines and utilities written in C, most of them UNIX derived or inspired and a couple of them uncommon.
Local articles
- Finn Overgaard Hansen: 12 Common C Errors - Outdated but still somewhat useful especially for beginners and intermediate users.
- Tutorials and other learning material
- EDM/2 has its own C tutorial, it's called simply Introduction to C Programming, and was written by Carsten Whimster:
- Aalto University and the University of Helsinki have a free course in C called Aalto-C
- MIX Software has a number of video courses available that focus on teaching C, these are focused primarily towards the beginner, note that these are delivered in VHS cassette format.
Links
- comp.lang.c.moderated - Moderated C discussion group
- comp.lang.c Frequently Asked Questions - FAQ compiled by Steve Summit
Standards
- Early versions do not follow any standard apart from the C Reference Manual that was included with the UNIX system release and there were lots of early C versions out there that were incompatible with each other, with every American university appearing to have its own minor variant for a while.
- In 1978 Brian Kernighan and Dennis Ritchie published "The C Programming Language" book which became an informal standard, referred to as "K&R C", the only problem being that it is not 100% internally coherent.
- The ISO/IEC JTC1/SC22/WG14 working group produced the ISO/IEC 9899:1999 which is known informally as "C99", note that there are three later additions/amendments to the standard and therefore not all C99 code is 100% compatible.
- In 2011 the ISO/IEC 9899:2011 or "C11" standard was introduced, while there is some language changes, the main changes are in the standard libraries.