News for hackers. Stuff that matters.
Re:What Have We Learned from the PDP-11? by panic on Wednesday December 06, 2017 @07:44PM (#15866578)
One can write a string copy routine using two instructions, assuming that the source and destination are already in registers.

    loop:   MOVB (src)+, (dst)+
            BNE loop
Suddenly the C idiom

    while (*dst++ = *src++);
makes a lot more sense!
Re:What Have We Learned from the PDP-11? by Crashprofessor on Thursday December 07, 2017 @09:32AM (#15870224)
Though Ritchie has portrayed the similarities as coincidence,

http://csapp.cs.cmu.edu/3e/docs/chistory.html

The influence of the 11's indexing [Bell] versus the 8 on C/Unix abounds, whatever your perspective on 'Macro' move instructions, they were certainly the obvious follow on rage, witness the Movc3/Movc5 in the Vax.

I've always enjoyed the notes K&R made following a non-disclosure presentation of the Vax, the most prescient I recall being a comment on the 512 page size.

https://www.bell-labs.com/usr/dmr/www/vax1.html

I revered the 11, had Qbus machines which could be assembled with superior 3rd party components in places, scattered through my apt/basement as a student from the 23 through the j11 all the way up to a MV2.

Everything since has been anticlimactic :)

Re:What Have We Learned from the PDP-11? by dbcurtis on Wednesday December 06, 2017 @08:15PM (#15866752)
For sure. If you look at Old Testament K&R C and PDP-11 assembly language side by side, you can see the mapping very clearly. It's been a looooong time since I did PDP-11 at that level, but if memory serves, I'm pretty sure that a switch(e) {...} can be done as a single jump instruction with indexed-indirect addressing mode.
Re:What Have We Learned from the PDP-11? by hazeii on Thursday December 07, 2017 @04:14AM (#15868685)
Adding fun with PDP-11 autoincrement:-

   MOV (PC)+,(PC)+
What does that do? It's a single-instruction program that replicates itself throughout memory.
Re:What Have We Learned from the PDP-11? by cesarb on Thursday December 07, 2017 @08:56AM (#15869964)
Suddenly Core War (https://en.wikipedia.org/wiki/Core_War) makes a lot more sense.
Re:What Have We Learned from the PDP-11? by agumonkey on Wednesday December 06, 2017 @08:34PM (#15866854)
Teacher regularly called C a macroassembler
Re:What Have We Learned from the PDP-11? by davidw on Thursday December 07, 2017 @12:07AM (#15867756)
"C: all the power of assembly language with all the ease-of-use of assembly language"
Re:What Have We Learned from the PDP-11? by beefhash on Thursday December 07, 2017 @12:10AM (#15867769)
Not quite, unfortunately. In assembly language, you don't have to fear that your compiler optimizes out clearing cryptographic keys out of memory at the end of a function.
Re:What Have We Learned from the PDP-11? by syrrim on Thursday December 07, 2017 @01:14AM (#15868022)
In assembly, you don't have to worry about pesky optimizations speeding up your code at all. A similar effect can be achieved in C by not manually enabling optimizations.
Re:What Have We Learned from the PDP-11? by dangerface on Thursday December 07, 2017 @10:12AM (#15870659)
"A similar effect can be achieved in C by not manually enabling optimizations."

Good luck with that.

Re:What Have We Learned from the PDP-11? by mpweiher on Thursday December 07, 2017 @05:02PM (#15874777)
Nor in K&R C. Or even early ANSI-C. This whole "we can use undefined behavior to "optimize" away half your program" idea is fairly new.
Re:What Have We Learned from the PDP-11? by OliverJones on Thursday December 07, 2017 @10:30AM (#15870875)
Yah, and guess what machine instructions bk and dmr were targeting with that compiler!