more changes
This commit is contained in:
parent
64bdfbf906
commit
e50cab2d15
2
wiki/tail.m4
Normal file
2
wiki/tail.m4
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
</BODY>
|
||||||
|
</HTML>
|
@ -7,7 +7,7 @@ On Alpine Linux, the standard library headers are in the _package(`musl-dev') pa
|
|||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
Many Linux software distributions' system package managers have meta-packages that pull all necessities for C development as dependencies.
|
Many Linux software distributions' system package managers have meta-packages that pull all necessities for C development as dependencies.
|
||||||
Alpine has _code(`build-base') and Debian has _code(`build-essential').
|
Alpine has _package(`build-base') and Debian has _package(`build-essential').
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
For linking to libraries, see _ref(`#pkg-config').
|
For linking to libraries, see _ref(`#pkg-config').
|
||||||
@ -31,7 +31,9 @@ The language evolved out of the former B programming language, which was a produ
|
|||||||
</BLOCKQUOTE>
|
</BLOCKQUOTE>
|
||||||
<FIGCAPTION>(<CITE>The Development of the C Language</CITE>)</FIGCAPTION>
|
<FIGCAPTION>(<CITE>The Development of the C Language</CITE>)</FIGCAPTION>
|
||||||
</FIGURE>
|
</FIGURE>
|
||||||
<P>[Thompson 69] references <CODE>K. Thompson, `Bon—an Interactive Language,' undated AT&T Bell Laboratories internal memorandum (ca. 1969)</CODE>. This is possibly <A HREF="http://people.csail.mit.edu/saltzer/Multics/MHP-Saltzer-060508/filedrawers/180.btl-misc/Scan%204.PDF">Bon User's Manual</A>.
|
<P>
|
||||||
|
[Thompson 69] references _cite(`K. Thompson, "Bon—an Interactive Language," undated AT&T Bell Laboratories internal memorandum (ca. 1969)').
|
||||||
|
This is possibly <A HREF="http://people.csail.mit.edu/saltzer/Multics/MHP-Saltzer-060508/filedrawers/180.btl-misc/Scan%204.PDF">Bon User's Manual</A> but it's not conclusive.
|
||||||
Please get in touch if you have a hyperlink for this document as I can't find it indexed on any search engines.</P>
|
Please get in touch if you have a hyperlink for this document as I can't find it indexed on any search engines.</P>
|
||||||
<P>
|
<P>
|
||||||
This language described in <I>The C Programming Language</I> isn't the C programming language known by most.
|
This language described in <I>The C Programming Language</I> isn't the C programming language known by most.
|
||||||
@ -39,18 +41,10 @@ It was a pre-standardization, relatively prototypical C, and rather than being c
|
|||||||
This was known as "pre-ANSI C" or "K&R C" and dubbed "C78" for the purposes of naming this page, in the same style as the later "C89", described in ANSI X3.159-1989, or "C11", described in ISO/IEC 9899:2011.
|
This was known as "pre-ANSI C" or "K&R C" and dubbed "C78" for the purposes of naming this page, in the same style as the later "C89", described in ANSI X3.159-1989, or "C11", described in ISO/IEC 9899:2011.
|
||||||
"C78" was also the name given to historical C by the <CODE>c78(7)</CODE> manual page on FreeBSD 9.0.
|
"C78" was also the name given to historical C by the <CODE>c78(7)</CODE> manual page on FreeBSD 9.0.
|
||||||
</P>
|
</P>
|
||||||
<P>
|
_subsubheader(`_italic(`8') and _italic(`9') as valid octal digits')
|
||||||
"C78" is incompatible with "C89" and later standards.
|
_bibliography(`
|
||||||
This page documents those incompatibilities and relative oddities.
|
_bentr(`_ref(`#Unix#V6') - see /usr/source/c/ in the Sixth Edition root tree')
|
||||||
</P>
|
')
|
||||||
<P>
|
|
||||||
I have never done (and probably never will do) extensive programming in pre-ANSI C.
|
|
||||||
These incompatibilities were discovered out of Appendix C in <I>The C Programming Language, 2nd ed.</I> but are described further.
|
|
||||||
</P>
|
|
||||||
<H4 ID="octal89"><CODE>8</CODE> and <CODE>9</CODE> as valid octal digits</H4>
|
|
||||||
<UL>
|
|
||||||
<LI><A HREF="https://minnie.tuhs.org/cgi-bin/utree.pl?file=V6/usr/source/c">UNIX V6 C compiler source directory</A></LI>
|
|
||||||
</UL>
|
|
||||||
<PRE>
|
<PRE>
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@ -60,7 +54,7 @@ main()
|
|||||||
}
|
}
|
||||||
</PRE>
|
</PRE>
|
||||||
<P>
|
<P>
|
||||||
On my machine, the GNU C compiler emits the following errors (this omits warnings) for the preceding piece of code:
|
The GNU C compiler emits the following errors (this omits warnings) for the preceding piece of code:
|
||||||
</P>
|
</P>
|
||||||
<PRE>
|
<PRE>
|
||||||
snippet.c:4:49: error: invalid digit "8" in octal constant
|
snippet.c:4:49: error: invalid digit "8" in octal constant
|
||||||
@ -72,8 +66,8 @@ snippet.c:4:53: error: invalid digit "9" in octal constant
|
|||||||
</PRE>
|
</PRE>
|
||||||
<P>
|
<P>
|
||||||
This is because in C (both pre-standardization and post-ANSI) integer constants with leading zeroes are parsed as octal (base 8) numbers.
|
This is because in C (both pre-standardization and post-ANSI) integer constants with leading zeroes are parsed as octal (base 8) numbers.
|
||||||
In pre-ANSI C, <CODE>8</CODE> and <CODE>9</CODE> were valid octal digits corresponding to <CODE>010</CODE>(b8) and <CODE>011</CODE>(b8).
|
In pre-ANSI C, _italic(`8') and _italic(`9') were valid octal digits corresponding to _italic(`010')(b8) and _italic(`011')(b8).
|
||||||
This is documented in <I>The C Programming Language</I>, Appendix A, subsection 2.4.1, and evidenced by the preceding code block.
|
This is documented in _cite(`The C Programming Language'), Appendix A, subsection 2.4.1, and evidenced by the preceding code block.
|
||||||
The following is output of the compiled program in UNIX V6 on an emulated PDP-11:
|
The following is output of the compiled program in UNIX V6 on an emulated PDP-11:
|
||||||
</P>
|
</P>
|
||||||
<PRE>
|
<PRE>
|
||||||
@ -89,21 +83,30 @@ The following is output of the compiled program in UNIX V6 on an emulated PDP-11
|
|||||||
9
|
9
|
||||||
</PRE>
|
</PRE>
|
||||||
<P>
|
<P>
|
||||||
This behavior exists within <CODE>/usr/source/c/c0t.s</CODE>, which is a PDP-11 assembler file that parses integer constants (as far as I can tell).
|
This behavior exists within _code(`/usr/source/c/c0t.s'), which is a PDP-11 assembler file that parses integer constants (as far as I can tell).
|
||||||
This file provides <CODE>getnum</CODE>, a function used in <CODE>/usr/source/c/c00.c</CODE>.
|
This file provides _program(`getnum'), a function used in _code(`/usr/source/c/c00.c').
|
||||||
My theory is that this behavior is a side-effect of a very efficient but imperfect method of parsing integer constants from a file stream.
|
My theory is that this behavior is a side-effect of a very efficient but imperfect method of parsing integer constants from a file stream.
|
||||||
</P>
|
</P>
|
||||||
<P>
|
<P>
|
||||||
This wouldn't be a significant or even noticeable error; most programmers wouldn't use <CODE>8</CODE> or <CODE>9</CODE> as octal digits anyway.
|
This wouldn't be a significant or even noticeable error; most programmers wouldn't use _italic(`8') or _italic(`9') as octal digits anyway.
|
||||||
If not for its documentation within <I>The C Programming Language</I> it would probably be an obscure bug.
|
If not for its documentation within _cite(`The C Programming Language') it might have totally faded into obscurity.
|
||||||
This is also mentioned in <I>The C Programming Language, 2nd ed.</I> in Appendix C.
|
This is also mentioned in _cite(`The C Programming Language, 2nd ed.') in Appendix C.
|
||||||
|
</P>
|
||||||
|
_subheader(`Standardization')
|
||||||
|
_bibliography(`
|
||||||
|
_bentr(`_link(`Standard C: The ANSI Draft Grows Up', `https://archive.org/details/PC-Mag-1988-09-13/page/n115/')')
|
||||||
|
_bentr(`_link(`A Brief History of GCC', `https://gcc.gnu.org/wiki/History')')
|
||||||
|
')
|
||||||
|
<P>
|
||||||
|
In 1987, Richard M. Stallman, then a former MIT hacker who was working full time on the _italic(`GNU Project'), a re-implementation of the Unix operating system,
|
||||||
|
released the first beta release of _italic(`GCC'), then the _italic(`GNU C Compiler') and later re-named the _italic(`GNU Compiler Collection').
|
||||||
</P>
|
</P>
|
||||||
_subheader(`C1989')
|
_subheader(`C1989')
|
||||||
_subheader(`C1999')
|
_subheader(`C1999')
|
||||||
<UL>
|
_bibliography(`
|
||||||
<LI>_link(`C99', `https://en.wikipedia.org/wiki/C99') (Wikipedia)</LI>
|
_bentr(`_link(`C99', `https://en.wikipedia.org/wiki/C99') (Wikipedia)')
|
||||||
<LI>_link(`c99(1p)', `https://www.man7.org/linux/man-pages/man1/c99.1p.html')</LI>
|
_bentr(`_link(`c99(1p)', `https://www.man7.org/linux/man-pages/man1/c99.1p.html')')
|
||||||
</UL>
|
')
|
||||||
_subheader(`C2011')
|
_subheader(`C2011')
|
||||||
_subheader(`C2017')
|
_subheader(`C2017')
|
||||||
_subheader(`C202x')
|
_subheader(`C202x')
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
SOURCES = \
|
SOURCES = \
|
||||||
../wiki.m4 \
|
../wiki.m4 \
|
||||||
|
../tail.m4 \
|
||||||
macros.m4 \
|
macros.m4 \
|
||||||
unix.m4 \
|
unix.m4 \
|
||||||
posix.m4 \
|
posix.m4 \
|
||||||
@ -11,7 +12,6 @@ SOURCES = \
|
|||||||
fonts.m4 \
|
fonts.m4 \
|
||||||
fstab.m4 \
|
fstab.m4 \
|
||||||
linux.m4 \
|
linux.m4 \
|
||||||
m4.m4 \
|
|
||||||
netbsd.m4 \
|
netbsd.m4 \
|
||||||
manual.m4 \
|
manual.m4 \
|
||||||
multitasking.m4 \
|
multitasking.m4 \
|
||||||
|
@ -1,19 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
define(`_DESCRIPTION', `Unix is a multitasking operating system designed with simplicity in mind.')dnl
|
||||||
<HTML LANG="en">
|
define(`_PAGE', `Unix')dnl
|
||||||
<HEAD>
|
include(`../wiki.m4')dnl
|
||||||
<META CHARSET="UTF-8" />
|
include(`macros.m4')dnl
|
||||||
<META CONTENT="Unix is a multitasking operating system designed with simplicity in mind." NAME="description" />
|
|
||||||
<META CONTENT="noindex" NAME="googlebot" /> <!-- FUCK GOOGLE -->
|
|
||||||
<META CONTENT="interest-cohort=()" HTTP-EQUIV="Permissions-Policy" /> <!-- FUCK GOOGLE -->
|
|
||||||
<META CONTENT="width=device-width, initial-scale=1" NAME="viewport" />
|
|
||||||
<LINK HREF="https://be.murderu.us/unix" REL="canonical" />
|
|
||||||
<LINK HREF="../css/stylesheet.css" REL="stylesheet" />
|
|
||||||
<TITLE>UNIX - be.murderu.us</TITLE>
|
|
||||||
</HEAD>
|
|
||||||
<BODY>
|
|
||||||
include(`../wiki.m4')
|
|
||||||
include(`macros.m4')
|
|
||||||
<H1><A HREF="https://be.murderu.us/">be.murderu.us</A>/unix</H1>
|
|
||||||
|
|
||||||
include(`unix.m4')
|
include(`unix.m4')
|
||||||
|
|
||||||
@ -35,8 +23,6 @@ include(`fstab.m4')
|
|||||||
|
|
||||||
include(`linux.m4')
|
include(`linux.m4')
|
||||||
|
|
||||||
include(`m4.m4')
|
|
||||||
|
|
||||||
include(`netbsd.m4')
|
include(`netbsd.m4')
|
||||||
|
|
||||||
include(`manual.m4')
|
include(`manual.m4')
|
||||||
@ -53,5 +39,4 @@ include(`volumes.m4')
|
|||||||
|
|
||||||
include(`X.m4')
|
include(`X.m4')
|
||||||
|
|
||||||
</BODY>
|
include(`../tail.m4')dnl
|
||||||
</HTML>
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
<H2 ID="m4">m4</H2>
|
|
||||||
<UL>
|
|
||||||
<LI><A HREF="Notes on the M4 Macro Language">https://mbreen.com/m4.html</A></LI>
|
|
||||||
</UL>
|
|
@ -171,6 +171,12 @@ A traditional _man(`ed(1)') implementation is in plan9ports.
|
|||||||
I'm pretty sure some later UNIX-based OSes doubled the _man(`ed(1)') buffers, there's pretty much no downside to doing so in the modern era but it should be very easy to do yourself if it hasn't already been done (just double some of the array sizes in the beginning of _code(`ed.c')).
|
I'm pretty sure some later UNIX-based OSes doubled the _man(`ed(1)') buffers, there's pretty much no downside to doing so in the modern era but it should be very easy to do yourself if it hasn't already been done (just double some of the array sizes in the beginning of _code(`ed.c')).
|
||||||
</P>
|
</P>
|
||||||
|
|
||||||
|
_subheader(`m4(1)')
|
||||||
|
_bibliography(`
|
||||||
|
_bentr(`_link(`m4', `https://en.wikipedia.org/wiki/`M4_'(computer_language)') (Wikipedia)')
|
||||||
|
_bentr(`_link(`Notes on the M4 Macro Language', `https://mbreen.com/m4.html')')
|
||||||
|
')
|
||||||
|
|
||||||
_subheader(`make(1)')
|
_subheader(`make(1)')
|
||||||
<P>
|
<P>
|
||||||
_man(`make(1)') in modern times is fragmented into the GNU version <I>gmake</I> and the BSD version <I>bmake</I>.
|
_man(`make(1)') in modern times is fragmented into the GNU version <I>gmake</I> and the BSD version <I>bmake</I>.
|
||||||
|
@ -4,6 +4,7 @@ _bentr(`_link(`A Research Unix Reader', `https://www.cs.dartmouth.edu/~doug/read
|
|||||||
_bentr(`_link(`Dennis Ritchie', `https://en.wikipedia.org/wiki/Dennis_Ritchie') (Wikipedia)')
|
_bentr(`_link(`Dennis Ritchie', `https://en.wikipedia.org/wiki/Dennis_Ritchie') (Wikipedia)')
|
||||||
_bentr(`_link(`Unix', `https://en.wikipedia.org/wiki/Unix') (Wikipedia)')
|
_bentr(`_link(`Unix', `https://en.wikipedia.org/wiki/Unix') (Wikipedia)')
|
||||||
_bentr(`_link(`unix-history-repo', `https://github.com/dspinellis/unix-history-repo') (GitHub)')
|
_bentr(`_link(`unix-history-repo', `https://github.com/dspinellis/unix-history-repo') (GitHub)')
|
||||||
|
_bentr(`_link(`The UNIX Time-sharing System - A Retrospective', `https://web.archive.org/web/20080504013206/http://cm.bell-labs.com/cm/cs/who/dmr/retro.html')')
|
||||||
')
|
')
|
||||||
_passage(`Wikipedia', `<P>
|
_passage(`Wikipedia', `<P>
|
||||||
Unix (/ˈjuːnɪks/; trademarked as UNIX) is a family of multitasking, multiuser 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.
|
Unix (/ˈjuːnɪks/; trademarked as UNIX) is a family of multitasking, multiuser 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.
|
||||||
@ -34,3 +35,7 @@ Thompson rewrote the game to run on a spare PDP-7 at Bell.
|
|||||||
Having written so much code already to get the PDP-7 to work, Thompson started to work on other things for it; a file system, some utilities for it, a command interpreter, and an assembler.
|
Having written so much code already to get the PDP-7 to work, Thompson started to work on other things for it; a file system, some utilities for it, a command interpreter, and an assembler.
|
||||||
Then, mid-1970, Brian Kernighan named the non-multiplexing Multics workalike _italic(`Unics'), which was somehow (see _cite(`Interview with Brian Kernighan')) bastardized into _italic(`Unix').
|
Then, mid-1970, Brian Kernighan named the non-multiplexing Multics workalike _italic(`Unics'), which was somehow (see _cite(`Interview with Brian Kernighan')) bastardized into _italic(`Unix').
|
||||||
</P>
|
</P>
|
||||||
|
_subheader(`V6')
|
||||||
|
_bibliography(`
|
||||||
|
_bentr(`_link(`Unix Sixth Edition root tree', `https://minnie.tuhs.org/cgi-bin/utree.pl?file=V6')')
|
||||||
|
')
|
||||||
|
17
wiki/wiki.m4
17
wiki/wiki.m4
@ -1,4 +1,6 @@
|
|||||||
changecom(`<!--', `-->')dnl
|
changecom(`<!--', `-->')dnl
|
||||||
|
define(`_ASCII_UPPER', `ABCDEFGHIJKLMNOPQRSTUVWXYZ')dnl
|
||||||
|
define(`_ASCII_LOWER', `abcdefghijklmnopqrstuvwxyz')dnl
|
||||||
define(`_bibliography', `<UL>$1</UL>')dnl
|
define(`_bibliography', `<UL>$1</UL>')dnl
|
||||||
define(`_bibliography_entry', `<LI>$1</LI>')dnl
|
define(`_bibliography_entry', `<LI>$1</LI>')dnl
|
||||||
define(`_bentr', `_bibliography_entry($1)')dnl
|
define(`_bentr', `_bibliography_entry($1)')dnl
|
||||||
@ -7,6 +9,7 @@ define(`_code', `<CODE>$1</CODE>')dnl
|
|||||||
define(`_header', `<H2 ID="$1">$1</H2>')dnl
|
define(`_header', `<H2 ID="$1">$1</H2>')dnl
|
||||||
define(`_italic', `<I>$1</I>')dnl
|
define(`_italic', `<I>$1</I>')dnl
|
||||||
define(`_link', `<A HREF="$2">$1</A>')dnl
|
define(`_link', `<A HREF="$2">$1</A>')dnl
|
||||||
|
define(`_lowercase', `translit(`$1', _ASCII_UPPER, _ASCII_LOWER)')dnl
|
||||||
define(`_passage', `<FIGURE>
|
define(`_passage', `<FIGURE>
|
||||||
<BLOCKQUOTE>$2</BLOCKQUOTE>
|
<BLOCKQUOTE>$2</BLOCKQUOTE>
|
||||||
<FIGCAPTION>(_cite(`$1'))</FIGCAPTION>
|
<FIGCAPTION>(_cite(`$1'))</FIGCAPTION>
|
||||||
@ -14,3 +17,17 @@ define(`_passage', `<FIGURE>
|
|||||||
define(`_ref', `_link(`$1', `$1')')dnl
|
define(`_ref', `_link(`$1', `$1')')dnl
|
||||||
define(`_subheader', `<H3>$1</H3>')dnl
|
define(`_subheader', `<H3>$1</H3>')dnl
|
||||||
define(`_subsubheader', `<H4>$1</H4>')dnl
|
define(`_subsubheader', `<H4>$1</H4>')dnl
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<HTML LANG="en">
|
||||||
|
<HEAD>
|
||||||
|
<META CHARSET="UTF-8" />
|
||||||
|
<META CONTENT="_DESCRIPTION" NAME="description" />
|
||||||
|
<META CONTENT="noindex" NAME="googlebot" /> <!-- FUCK GOOGLE -->
|
||||||
|
<META CONTENT="interest-cohort=()" HTTP-EQUIV="Permissions-Policy" /> <!-- FUCK GOOGLE -->
|
||||||
|
<META CONTENT="width=device-width, initial-scale=1" NAME="viewport" />
|
||||||
|
<LINK HREF="https://be.murderu.us/_lowercase(_PAGE)" REL="canonical" />
|
||||||
|
<LINK HREF="../css/stylesheet.css" REL="stylesheet" />
|
||||||
|
<TITLE>_PAGE - murderu.us wiki</TITLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY>
|
||||||
|
<H1>_link(`be.murderu.us', `https://be.murderu.us/')/_lowercase(_PAGE)</H1>
|
||||||
|
Loading…
Reference in New Issue
Block a user