104
votes
Accepted
Why do C to Z80 compilers produce poor code?
Quite often people don't know how to use the compilers or don't understand fully the consequences of code they write. There is optimization going on in the Z80 C compilers but it's not as complete as,...
103
votes
Accepted
How could early UNIX OS comprise so few lines of code?
If you look at the code in the modern Linux kernel, you will find that most of the code is in the device drivers. There are tens of millions of lines of code to support everything imaginable -- the ...
75
votes
How could early UNIX OS comprise so few lines of code?
Yes, and you can buy it in a fully annotated book and have your own copy to peruse, should you be a skeptic:
Lions, John; (1996) "Lions' Commentary on Unix", ISBN 978-1573980135
I have had a ...
74
votes
Accepted
Why did C have the return type before function names?
Dennis Ritchie’s paper on The Development of the C Language gives some idea of the reasoning behind this: namely, the fundamental rule in C that declaration syntax should match expression syntax.
For ...
73
votes
Why did C use the arrow (->) operator instead of reusing the dot (.) operator?
In the embryonic form of C described in the 1974 C Reference Manual, there was no requirement that the left operand of . actually be a structure, nor that the left operand of -> actually be a ...
73
votes
When was this C function definition style, with type declarations of parameters after the parameter list, invented?
It's the original C syntax as designed by Dennis Ritchie, so bite your tongue :-)
As mentioned in another answer, the style was not unusual at the time. For an example of early art: FORTRAN II (1958) ...
71
votes
Accepted
Why did C use the arrow (->) operator instead of reusing the dot (.) operator?
Some of the first C code I saw was like this: 0x8040->output = 'A'; — its purpose was accessing memory mapped I/O locations. Needless to say it took me a while to figure out what this ...
66
votes
Why do C to Z80 compilers produce poor code?
If you try translating C into Z80, you'll see that Z80 index registers and stack don't behave quite as you expect. So, let us begin with
Arrays
Suppose you have a standard C construction
int c[10];
...
59
votes
Why do C to Z80 compilers produce poor code?
The main downside of "historic" CPU's (non?)-suitability for C programs is the lack of capability to form more than one register into an address without using the ALU.
Most more modern CPUs can use ...
59
votes
Have programming languages driven hardware development?
Simply yes.
And not just a few instructions, but whole CPUs have been developed with languages in mind. Most prominent maybe Intel's 8086. Already the basic CPU was designed to support the way high ...
57
votes
Accepted
Why were single quotes ('…') chosen for characters, and double quotes ("…") for strings?
For type system reasons, and for compatibility with B.
B is a programming language that served as the immediate ancestor of C. The salient thing about B is that it had no type system: all values in B ...
56
votes
Why weren't 80s arcade games programmed in C?
I think the question I would ask is why would you program arcade gamers in C back in the 80's.
Firstly, C was not nearly as popular in the world of microprocessor programming as you might imagine back ...
55
votes
When if ever was the C language 'int' size altered from the host machine word (register) size into a literal 32 bit size?
The C standard of the language doesn't mandate a 32-bit int. It defines
sizeof(char) = 1
and
sizeof(long long) ≥ sizeof(long) ≥ sizeof(int) ≥ sizeof(short) ≥ sizeof(char)
It also mandates that the ...
55
votes
Was there any technological reason that C was designed to return only a single thing from a function?
The premise of the question is incorrect.
In the first edition of the C Programming Language book (thanks to @JonathanPotter), the authors mention the intent to support passing structs to functions ...
52
votes
Accepted
Have programming languages driven hardware development?
Interesting question with an interesting answer.
First let me get one thing out of the way:
One example from this answer mentions how C pointers were, at least in part, influenced by the design ...
49
votes
Accepted
Why (historically) include the number of arguments (argc) as a parameter of main?
K&R first edition (1978) does not mention the NULL terminator in the argv list at all. This was added later, in ANSI C. The relevant paragraph (section 5.11, p. 110) is:
In environments that ...
49
votes
Accepted
How did varargs in C develop?
It was a pointer arithmetic hack, later abstracted away into a more portable form in some version of Unix; even later, it was adapted into ANSI C.
In many languages (like Pascal for example), variadic ...
46
votes
Accepted
Which tools were used to create the C language?
C didn't spring into being suddenly, but was created by slowly modifying the B language--which was written in itself. Therefore you might say that C was always written in itself, but at first it was ...
46
votes
Why did C use the arrow (->) operator instead of reusing the dot (.) operator?
Despite your assertion, there would in fact be situations where it would be ambigious.
First off, early C compilers were very simple. This was in fact the main appeal of the language, as compilers ...
45
votes
Have programming languages driven hardware development?
One interesting example of programming languages driving hardware development is the LISP machine. Since "normal" computers of the time period couldn't execute lisp code efficiently, and there was a ...
43
votes
What was the first C compiler for the Mac?
The Early Days
As you said, the most important languages on the Mac in its early days were Microsoft's BASIC, Pascal, and, of course, 68000 assembly. The Macintosh's System Software and ROMs were ...
43
votes
How to get started writing C for the IBM PC in 1980-81
So you want to write a C program for the IBM PC before the first C compiler for the PC is released. How do you go about it?
There are three options I can see:
Write your own C compiler
Use a cross ...
43
votes
Why do C to Z80 compilers produce poor code?
Simple answers one easily gets to this question are The Z80 Sucks and C Sucks - depending on the side someone is on. While they are of course, untrue (*1), there are real issues. A major argument for ...
42
votes
Accepted
Where is the ancient preprocessor?
In V6, the C preprocessor is part of cc, the compiler driver; see the expand() function in cc.c. The directory you linked to contains the source code to the two passes of the C compiler, c0 and c1 (...
40
votes
Why (historically) include the number of arguments (argc) as a parameter of main?
The requirement that argv[argc] be NULL was added in the ANSI C standard; it wasn’t a requirement before then, and some environments didn’t null-terminate the array (the strings themselves were of ...
39
votes
Accepted
Was Dennis Ritchie being too modest in this quote about C and Pascal?
Was Ritchie correct, or was he just being modest?
I’m not sure modesty plays a part here; I don’t see any statement of value attached to the size of a language’s family.
As of the date of the ...
39
votes
Why couldn't early C compilers handle variable declarations between statements?
Some early compilers, such as the ones described in the 1974 C reference manual, required that all automatic object declarations within a function precede the first executable code therein. Imposing ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
c × 101history × 24
compilers × 23
programming × 20
ms-dos × 17
assembly × 11
unix × 7
z80 × 5
pdp-11 × 5
design-choices × 5
source-reconstruction × 5
memory × 4
zx-spectrum × 4
software-development × 4
floating-point × 4
cc65 × 4
16-bit × 4
hardware × 3
graphics × 3
commodore-64 × 2
amiga × 2
ibm-pc × 2
emulation × 2
6502 × 2
apple-macintosh × 2