News for hackers. Stuff that matters.
Re:Modern C [pdf] by pjmlp on Monday November 28, 2016 @10:05AM (#13055813)
C was not the only way of doing it.

Many of us were enjoying the danger of getting low level with Think/Quick/Turbo Pascal and Modula-2.

Re:Modern C [pdf] by wiz21c on Monday November 28, 2016 @10:08AM (#13055837)
Turbo Pascal even allowed to mix in assembler right in your source code. That was super awesome at that time. No need to write separate assembly code, no need to link !

(not to say that Turbo Pascal was the only one to do that, just fond memories...)

Re:Modern C [pdf] by pjmlp on Monday November 28, 2016 @10:27AM (#13055972)
I once wrote a mouse driver for MS-DOS like that.
Re:Modern C [pdf] by vram22 on Monday November 28, 2016 @11:25AM (#13056398)
Interesting. Though I used Turbo Pascal quite a lot earlier, I either don't remember that feature (being able to mix in assembly) or may have known of it then but forgotten it later. Getting a vague recollection - was it something like a function call of sorts (syntax-wise)? Start with a $something, then open parens, then some assembly statements, then close parens)?

If that was the way it was done in TP, the BBC micro (which was mentioned quite a bit in the recent HN thread about BASICs on personal computers of earlier years), also had a similar feature. I did use that one a bit. You had to open a square bracket in the middle of your BASIC program (though probably not in the middle of a BASIC statement), write your assembly code (6502 instruction set), and then close the square bracket, IIRC.

D (language) these days also has the ability to mix in assembly, though I haven't tried it yet.

Edited for typos and wording.

Re:Modern C [pdf] by pjmlp on Monday November 28, 2016 @12:10PM (#13056766)
In TP you could use inline Assembly in several ways.

It could be just a block, a complete procedure/function with or without prolog.

Also it was quite comfortable to write, just as a plain macro Assembler with Intel syntax, not those asm functions with strange syntax used in gcc/clang.

Re:Modern C [pdf] by snerbles on Monday November 28, 2016 @11:22AM (#13056375)
C also allows for inline assembly.
Re:Modern C [pdf] by nurettin on Monday November 28, 2016 @10:43AM (#13056080)
Modern delphi carries that tradition.
Re:Modern C [pdf] by ArkyBeagle on Monday November 28, 2016 @06:24PM (#13059311)
I don't recall specifically about MSC but Turbo C had the same....

We considered having all the assembler in separate files better practice...

Re:Modern C [pdf] by nickpsecurity on Monday November 28, 2016 @09:07PM (#13060129)
Even in embedded examples, I see a lot of inline ASM in C functions. So, what's separate files like? Do you just compile them separately, link them in as libraries, wrap them as a C function, and then call it? And what was the argument for this over just putting them inside functions of C source where necessary?
Re:Modern C [pdf] by ArkyBeagle on Monday November 28, 2016 @10:28PM (#13060536)
We'd generally wrap them as C functions. We'd frequently use the compiler to generate the assembly; have a prototype and all that.

Which is better depends.