[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

On history and justification of C programming language: Best

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 20
Thread images: 1

File: qc2M2Ie.png (329KB, 384x800px) Image search: [Google]
qc2M2Ie.png
329KB, 384x800px
On history and justification of C programming language: Best System Language Ever or Bad by Design?
(numbered summary version)

There's a recurring theme where people think the C language's design is good for systems programming, even today. These people think that someone sat down, thought of every tradeoff, and made the best ones for system programming. They assume it couldn't have been better because any modification would hurt its goals of performance or portability. This isn't true in the slightest and totally contradicts real reasons why C is designed the way it is. Even back then, there were better languages/OS's [1] that cheap hardware just hadn't caught up to. That cheap hardware's limitations, and them alone, drove the design decisions of BCPL, B, and then C.

You wouldn't want my opinion, though: let's look a historical records and papers on the development of these. Hacker New's commenter pjmlp sent me a great video [2] detailing the history of C and C++ languages w/ pics and paper excerpts. The author takes it step-by-step showing what the goals were, what they were using, the problems they encountered, and what changes they made. Thompson and Ritchie actually had little to do with most of C's key decisions and philosophy: borrowed or stolen from BCPL at Cambridge with little to no credit early on. They kind of went with it from there.
>>
Numbered List of Key Points in C's History

1. Starts with assembler code on EDSAC [3], the Most Godawful Computer on Earth (TM).

2. University orders a watered-down Atlas called Titan/Atlas2. Must wait years to get it and still another year to make it run.

3. Need new language for it plus it was trendy to make new languages for new computers.

4. ALGOL60 [4] had many nice features of languages today but was too theoretical: only existed on paper.

5. Fortran was locked into IBM mainframes and mapped 1-to-1 to their hardware, not Atlas or Titan.

6. Designed CPL language as a real-world version of ALGOL *before* their Titan shipped. CPL had all kinds of features supporting many types of applications, even lambda calculus!

7. Had to use Most Godawful Computer on Earth (EDSAC) to build the CPL compiler.

8. Queued up behind others with snippets of EDSAC machine code testing pieces of it. Predictably, this didn't scale to CPL's size and complexity. Abandoned CPL compiler.

9. New design goal: trim out anything hard to compile from CPL. Naturally eliminates most features for robust and maintainable programming.

10. New design goal: give programmer total control to the point that he or she can do arbitrary stuff in memory. Maps better to Most Godawful Computer on Earth's style of execution and constraints.
>>
and tools sucked. He and Ritchie decided to build a bare-bones version of MULTICS, called UNICS, in assembly focusing on simplicity and performance above everything. Stripped out or changed most features benefiting safety/security, maintenance, and consistency.

15. Around same time, Thompson was trying to get BCPL to work on his similarly-awful PDP-7. Had to trim it further to make it fit. Changed syntax for personal style. That included long-time headaches like going from ALGOL := assignment and = equality to = assignment and == equality. Resulted in B language.

16. The PDP-11 [8] was byte/character-oriented instead of word-oriented. B didn't work well. Ritchie added limited typing to it to support these plus a few other changes. Result was the C language.

17. Rewrote parts of UNIX in C. Others were too hard.

18. Those difficulties led to adding struct's which allowed rest to be re-written in C. Neither C nor UNIX were meant to be portable despite some people's claim it was a "cross-platform assembler."

18. Simplicity of C and UNIX allowed easy porting anyway which started from a year later onward by other people.

19. K&R adds some types and standard I/O. Remained for years the baseline for portable C.

20. Bjourne loves programming in Simula [9]: an ALGOL60 superset with classes and concurrency. Creates C with Classes to bring it closer to Simula.

21. Bjourn adds features from ALGOL68, Ada, CLU, and ML to C w/ Classes to produce C++: a C extension that reduces freedom where sensible but mostly adds features for productive or maintainable programming.

22. ANSI C standard created a superset of C features, including some from C++. Becomes standard style for C programming. Tons more code written this way.
>>
Conclusion(s)

So, there you have it. They started with a great language (ALGOL60) that inspired Go, etc. Needed something ground in reality, leading to similarly great CPL. Hardware and software were so hard to use they stripped it to bare minimum (BCPL). Thompson stripped that to B because his PDP-7 was too limited and added syntax problems purely due to preference. Ritchie added a little to that to get the PDP-11 to work, resulting in C. Added struct's to for more complex data structures. Writing the simple, UNIX in C language caused C to flourish as it did due to social and economic reasons [10]. Eventual standard borrowed a bit from C++. All the C code out there resulted.

Hardware eventually got better than EDSAC, PDP-7, or PDP-11. Language and OS decisions created due to its limitations aren't removed. All of that is extended or worked around instead. UNIX and later C applications have those issues as a result. Result is a mess so huge [11] that it might be impossible to fix.

Conclusion: the worst aspects of UNIX and C were intention design decisions that had nothing to do with what a good, systems language should look like and everything to do with limitations of an EDSAC, PDP-7, & PDP-11.

Conclusion 2: we should've ditched or modified C to look more like ALGOL68 a long time ago. Like Bjourne and Wirth were doing.

Conclusion 3: C and UNIX should be avoided where possible because they're Bad by Design for reasons that stopped applying sometime in the 80's or early 90's.

However, if you're device's hardware is PDP-11 equivalent, then there is a language and OS that are stripped enough to run on it. Might want to consider C and UNIX 1.0 then. ;)
>>
Missing list items:

11. The result of these was BCPL [5]: a typeless, word-oriented language with few keywords and unrestricted use of memory. Created philosophy of "the programmer is in charge and gets no help." Compiler was easy to write on Most Godawful Computer on Earth. Ran fast on it, too.

12. BCPL author took it with him to MULTICS project [6], where Ken Thompson and Dennis Ritchie were working. Got used on some portions of it. Thompson apparently liked it.

13. MULTICS was built but failed in market because of delays, scope, and cost ($7+ mil per unit).

14. Thompson was limited to a PDP-7 [7] in next job. It couldn't run MULTICS or advanced languages on it. Plus, PDP-7's OS and tools sucked.
>>
>>56175099
C is what keeps the singularity from happening.
>>
>>56175099
C is a programming language for men.
>>
Then how in hell is C still a thing in 2016, in the age where the most modern and powerful framework is considered old shit two years later?
>>
>>56177116
Point to ANY other language that can do what C does.

You can't.
>>
>>56175646
>C is what keeps the singularity from happening.
C will play a crucial role in the singularity.
>>
>>56175099

Real story:

"In 1969, AT&&T had just terminated their work with the GE/Honeywell/AT&&T Multics project. Brian and I had just started working with an early release of Pascal from Professor Nichlaus Wirth's ETH labs in Switzerland and we were impressed with its elegant simplicity and power. Dennis had just finished reading 'Bored of the Rings', a hilarious National Lampoon parody of the great Tolkien 'Lord of the Rings' trilogy. As a lark, we decided to do parodies of the Multics environment and Pascal. Dennis and I were responsible for the operating environment. We looked at Multics and designed the new system to be as complex and cryptic as possible to maximize casual users' frustration levels, calling it Unix as a parody of Multics, as well as other more risque allusions. Then Dennis and Brian worked on a truly warped version of Pascal, called 'A'. When we found others were actually trying to create real programs with A, we quickly added additional cryptic features and evolved into B, BCPL and finally C. We stopped when we got a clean compile on the following syntax:

for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);

To think that modern programmers would try to use a language that allowed such a statement was beyond our comprehension! We actually thought of selling this to the Soviets to set their computer science progress back 20 or more years. Imagine our surprise when AT&&T and other US corporations actually began trying to use Unix and C! It has taken them 20 years to develop enough expertise to generate even marginally useful applications using this 1960's technological parody, but we are impressed with the tenacity (if not common sense) of the general Unix and C programmer. In any event, Brian, Dennis and I have been working exclusively in Pascal on the Apple Macintosh for the past few years and feel really guilty about the chaos, confusion and truly bad programming that have resulted from our silly prank so long ago."
>>
>>56178844
>C will play a crucial role in the singularity.

Yeah, thank god for that. Skynet will collapse the moment some bulgarian hacker finds a buffer overflow.
>>
>>56178739
>Point to ANY other language that can do what C does.

There aren't many languages prone to buffer overflow nowadays.
>>
>>56178739
Point to ANY other language that is as error prone and unmaintainable as C.

Pro tip, you can't.
>>
>>56177116
It isn't.
>>
>>56181276
>Point to ANY other language that is as error prone and unmaintainable as C.

Machine language.
Check point m8.
>>
>>56178739
Ada
>>
>>56175147
>a great language (ALGOL60) that inspired Go
Go is strictly worse than ALGOL https://cowlark.com/2009-11-15-go/
>>
>>56181690
>Ada

Bullshit, Ada code is safer by orders of magnitude.
>>
>>56181870
I never understood what the point of Ada as a language was. Do you just use it to take credit for someone else's work?
Thread posts: 20
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.