Questions tagged [programming]

Programming languages and constructs. Please check for language-specific tags first and use those instead, if applicable.

Filter by
Sorted by
Tagged with
105
votes
7answers
24k views

Why was `!` chosen for negation?

It seems that the use of the exclamation mark ! to denote negation started with the C programming language (as far as I can tell from my Google research). Nowhere though is mentioned who and why chose ...
94
votes
7answers
28k views

Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?

Reading the NESdev wiki page on CPU unofficial opcodes, I see a few games use an undocumented 2-byte NOP instuction in production: Puzznic, F-117A Stealth Fighter, and Infiltrator use $89 #i. Beauty ...
71
votes
7answers
13k views

Why wasn't ASCII designed with a contiguous alphanumeric character order?

Anyone who has dealt with strings at a low level (e.g., writing a parser in C), knows that doing so tends to involve frequent checks of—either manually, or through isalpha(), isalnum(), etc—whether a ...
65
votes
7answers
15k views

Where did the popularity of the `i` variable come from?

I have heard that the reason the i variable is used so much is because there was an old computer where each variable could only be a single letter and that reserved the variables a through h as ...
56
votes
4answers
11k views

Why were single quotes ('…') chosen for characters, and double quotes ("…") for strings?

In C, '' is used to denote a character, while "" is used to denote a string. Why was this syntax chosen? I tried to research this using Wikipedia’s Timeline of Programming Languages along ...
55
votes
6answers
14k views

How did old MS-DOS games utilize various graphic cards?

Nowadays each graphic card has some driver in operating system that translates some (typically) standard API such as OpenGL, so that programmers use some standardized API code to tell graphics cards ...
51
votes
1answer
6k views

How was collision detection done on the Asteroids arcade game?

In honor of today's landing of and sample collection by the OSIRIS-REx spacecraft on the asteroid Bennu: How did the arcade game Asteroids detect collisions between the screen objects (player's ship, ...
43
votes
8answers
8k views

What was the first programming book

I'm curious, what was the first book, about programming for digital computers. I tried to google it, but it led me to multiple results. I'm mostly interested in the language it was about and the ...
42
votes
5answers
8k views

Why didn't C++ specify filename extensions?

Apparently even today there is no single "official" standard for C++ file extensions. There are just common conventions. To me this stands out as an anomaly... file extensions are heavily ...
37
votes
4answers
12k views

Where does this esoteric Pascal operator come from?

In the documentation for an implementation of Pascal for a Soviet computer, I've encountered a very weird language extension. I'll try to translate it: Branching operator (branch) Syntax &...
35
votes
5answers
9k views

Why (historically) include the number of arguments (argc) as a parameter of main?

A comment on this answer to a StackOverflow question made me curious. According the C99 standard, section 5.1.2.2.1: The function called at program startup is named main. The implementation ...
34
votes
4answers
16k views

Who is credited for the creation of Assembly Language?

The C Programming Language was originally developed by Dennis Ritchie who also co-designed the Unix operating system with which development of the language was closely intertwined. Is there a ...
33
votes
6answers
11k views

Which was the first programming language that had data types?

Machine language (and Assembly language) don't have the concept of data types, so if you want to add an int and a float variables in Assembly, you have to use the appropriate Assembly instruction that ...
33
votes
5answers
7k views

Why was nil defined as a reserved word in Pascal?

In Pascal, nil (the pointer value to "nothing") is a reserved word. Why wasn't it simply a predefined identifier as true and false are, for example? This is stated in PASCAL User Manual and Report p....
33
votes
3answers
5k views

What was the first programming language to support “operator chaining”?

The Python language has a neat feature: An expression like x < y <= z is interpreted, according to mathematical convention, as equivalent to x < y and y <= z. Operands are evaluated only ...
32
votes
4answers
2k views

Why were early versions of BASIC different?

Most major computer manufacturers/distributors in the 70's and 80's included BASIC with their computers. Some (as answers to this great question have detailed: Why was BASIC built into so many ...
31
votes
3answers
4k views

Why is the ‘auto’ storage class specifier included in C?

The auto keyword in C seems quite redundant: wherever it makes sense to define a variable with automatic storage duration, it is already the default, so there is no reason to use the keyword. The ...
31
votes
3answers
4k views

How did Elite do vertex transformation?

In 3D graphics, vertex transformation is the process of converting x,y,z coordinates in 3D space, to x,y coordinates on the screen. According to https://www.khronos.org/opengl/wiki/...
30
votes
13answers
6k views

In what language(s) is the return value set by assigning to the function’s name?

In this Stack Overflow question the original code made the mistake of using the function name as a variable, and assigned the return value to it. A commenter mentioned that he once used a language ...
30
votes
5answers
6k views

How was the C language ported to architectures with non-power-of-2 word sizes?

By the time the C language started to gain popularity outside of the PDP-11 circles (mid-1970s), mainframes with "weird" word sizes, and no capability to address individual bytes efficiently were ...
27
votes
5answers
6k views

Why did the monsters have "infinite invisible pillars" of hitboxes vertically in all versions of the DOOM engine?

Even in the last version of the DOOM engine, v1.9, used for Final DOOM, there is this strange limitation in which all the monsters have an invisible, infinitely tall "pillar" above and ...
27
votes
2answers
6k views

How did the "Programmer's Switch" work on early Macintosh Computers?

The early Apple Macintosh computers (original Mac, Mac 512K, Mac Plus) all came with a "Programmer's Switch" installed on the side. I believe this persisted for a long time, with the switch ...
27
votes
7answers
16k views

How can you run a program that is bigger than RAM?

Suppose you have a program that is 218 words long. However you are using a 16 bit machine and have 216 words of RAM. (The RAM is directly addressed by the CPU). On the other hand, you have unlimited '...
27
votes
2answers
10k views

What is this programming language having PROC, DCL, LABEL keywords?

A 1980 paper called "Register Allocation via Coloring" contains something that looks like source code: P: PROC(MODE); DCL MODE BIT(1), (A1,A2,A3,A4,A5,A6,A7,A8,A9,A10, B1,B2,B3,...
27
votes
2answers
3k views

Apple II: Applesoft BASIC memory management

I am trying to write an Applesoft / floating point BASIC program using high resolution graphics and some assembly language code. My BASIC program is quite large, and after running the program for a ...
25
votes
7answers
5k views

Why do variable names in BASIC need type suffixes?

The BASIC I'm most familiar with is Atari BASIC since I had an Atari 800 way back when. The Atari BASIC Source Book includes details about how Atari BASIC maintains variables. There is a Variable Name ...
25
votes
9answers
2k views

What implementations of BASIC had a robust flood fill operator?

When I learned BASIC on Elektronika BK, I got fascinated with the flood fill (PAINT) operator: how does it know to get to all nooks and crannies of the shape to fill? I've devised an algorithm, tried ...
25
votes
3answers
3k views

How did programs on coding forms get run?

At some point in the past, around the 1970's or so, programmers wrote their code on paper. Considering the fact that modern computers have replaced paper in so many ways, the whole idea seems a little ...
23
votes
10answers
5k views

Was Objective-C really a hindrance to Apple software development? [closed]

I have heard stories from some of the greybeards I have met on the Internet that Objective-C was by all accounts a nightmare to work with. Was that just a thing about all the low-level languages of ...
23
votes
7answers
4k views

Was it possible programmatically to manipulate the volume as well as the pitch on computers with no sound chip?

On early versions of many 8-bit computers like the Apple II, Spectrum, and even the IBM PC, there was no sound hardware other than the simple "beeper". Programmers made sound by hitting a hardware ...
22
votes
1answer
2k views

Where are the sources of the original curses library?

The curses library is a terminal control library for Unix-like systems used in text based user interface applications. It has been used in many games in the past. It was developed by Ken Arnold and ...
21
votes
5answers
3k views

Early Forth for personal computers

What were the earliest Forth programming language implementations for 8-bit personal computers? Was it FIG Forth? Or a predecessor? Or some other development? Why did Forth lose its relative ...
21
votes
2answers
1k views

What's a good way to implement this "splashing water" effect on the C64?

This pillow fighting game set in Venice depicts the two opponents fighting on a wobbly gondola on a canal. It was apparently known as "Pillow Fight" in English and as "Kissenschlacht&...
20
votes
3answers
4k views

How were the 70's and 80's coin-op programmed?

How were the 70's and 80's coin-op programmed? What tools did a programmer use? Nowadays a programmer can use a PC, an IDE to program, test, use breakpoint... but in the 80s? How could a programmer ...
19
votes
8answers
7k views

Uses for the halt instruction?

What was the halt instruction in early CPUs such as the Z80 and 8080 used for? Here's a description of the Z80 instruction: The HALT instruction suspends CPU operation until a interrupt or reset ...
19
votes
6answers
4k views

What caused the downfall of Pascal? [closed]

From 1985 to 1990 Borland's Turbo Pascal was at least as popular as C for DOS systems. Turbo Pascal was especially popular because of it's ground breaking BGI graphics interface while C was stalled in ...
19
votes
2answers
2k views

How can I access the VGA card's ROM fonts with interrupt 10h operation 1130h in protected mode C?

I'm using Open Watcom 1.9 to write some 286 real mode, and 386 protected mode software for DOS in C. In real mode, I can retrieve a pointer to the system ROM character bitmaps in real mode using int ...
19
votes
1answer
559 views

Was the IBM S/360 Responsible for Popularizating the 'A'-to-'F' Notation in Hexadecimal Numbers?

In the early history of computing before the mid-1960s, there wasn't an universal, de-facto standard for the written representation of a hexadecimal number, different computer systems used their own ...
18
votes
9answers
2k views

How were bugs reported for compilers that were shipped on floppy disks?

Take the Microsoft C 1.0 compiler for example. It shipped on multiple 5.25" 360K disks, and when it ran on machines without internal hard disk, so users had to switch floppies between the editor, ...
18
votes
3answers
4k views

Do you need to allocate memory before you use it in MS-DOS?

In modern operating systems (for example: Windows), you can't access a memory location before you allocate that memory location to your program (or else a segmentation fault will occur). I am ...
18
votes
3answers
5k views

Which language had the first scanf?

As a companion to the question "What was the first programming language to have 'printf'?", which language had the first scanf? It doesn't have to be literally called scanf, but I am looking ...
18
votes
3answers
5k views

Native C compiler for Sinclair ZX Spectrum

I am looking for a native C compiler for the Spectrum 128. I would like one which: Has good support for the latest C standard at the time. Is not limited to compiling ridiculously short source code. ...
18
votes
2answers
2k views

What was the first language with regexes?

According to Wikipedia, Regular Expressions (AKA regexes) have only been around since 1956: Regular expressions originated in 1956, when mathematician Stephen Cole Kleene described regular ...
17
votes
3answers
3k views

Is there a way to get a compiler for the original B programming language?

I am learning about the original B programming language, but I don't have a compiler. Is there an emulator for an old computer that can run an old operating system that have a compiler for the ...
17
votes
2answers
2k views

When did FORTRAN decide on signed integers?

I have personally always been of the opinion that it would make sense for the default integer type to be unsigned, though it's been a long time since that would've been a live issue for debate; C in ...
17
votes
1answer
2k views

In what year did term "program" first appear in the meaning of "series of coded instructions"?

I'm trying to figure out year when the term "program" was firstly used is the meaning ‘a series of coded instructions which directs a computer in carrying out a specific task’. Additionally ...
17
votes
2answers
812 views

Color BASIC RND function not so random

The RND() function for random numbers appears to give the same results each time the computer is reset. How do I seed the random number generator with a random number?
16
votes
3answers
2k views

Why can't I invoke the next interrupt service by incrementing the AX register after calling the same interrupt?

I have two snippets of 8086 assembly code, both of which are supposed to do the same thing: make the mouse appear on the screen. Show_Mouse: push ax mov ax,0 ;Reset Mouse int 33h ...
16
votes
4answers
3k views

Why does Pascal have numeric labels?

Pascal was intended, in part, to be a simple language to implement. Some of the design decisions reflecting this are Declarations/definitions must be given in a strict order (labels, constants, types,...
16
votes
4answers
1k views

Toolchain and workflow to build CP/M

Building my own version of CP/M has always been a fascinating to-do project. Problem is that it seems that the source code is not in regular assembler, but some kind of macro-assembler like language ...