top | item 42387407

(no title)

larschdk | 1 year ago

When C was conceived, CPU architectures and platforms were more varied than what we see today. In order to remain portable and yet performant, some details were left as either implementation defined, or completely undefined (i.e. the responsibility of the programmer). Seems archaic today, but it was necessary when C compilers had to be two-pass and run in mere kilobytes of RAM. Even warnings for risky and undefined behavior is a relatively modern concept (last 10-20 years) compared to the age of C.

discuss

order

actionfromafar|1 year ago

When C was conceived, it was made for a specific DEC CPU, for making an operating system. The idea of a C standard was in the future.

If you wanted to know what (for instance) memcpy actually did, you looked at the source code, or even more likely, the assembler or machine code output. That was "the standard".

da_chicken|1 year ago

I think it's reasonable to assume that GP clearly meant the C standard being conceived, as, obviously, K&R's C implementation of the language was ad hoc rather than exhibiting any prescribed specification.

anticensor|1 year ago

No, K&R's book was the standard.

scoutt|1 year ago

> Seems archaic today ... run in mere kilobytes of RAM

There is an entire industry that does pretty much that... today. They might run in flash instead of RAM, but still, a few kilobytes.

Probably there are more embedded devices out there than PCs. PIC, AVR, MSP, ARM, custom archs. There might be one of those right now under your hand, in that thing you use to move the cursor.

krisoft|1 year ago

> There is an entire industry that does pretty much that... today.

Which industry runs C compilers on embeded devices? Because that is what the part you elipsised out was talking about.