On Thu, Jul 7, 2022 at 8:30 PM Daniel <codehunte...@gmail.com> wrote:
>
> I am unfamiliar woththe C languages,  but does it also allow one to mix both 
> assembly in with the C source code?  Are there any other languages that 
> allows mixing of assembly in with the language code?

Not in the manner you are thinking of.

C was developed to be a language used for systems programming.  It was
originally created by Dennis Ritchie at AT&T Bell Laboratories at
Murray Hill, NJ, as part of the effort that created the Unix OS.
Ritchie started with a language called BCPL, and enhanced that to
create C.  C was intended to be a high level language efficient enough
that you didn't have to write in Assembler to get performance, and
relatively easy to port to other architectures.

The developers of Unix were programmers unhappy with the support for
program development provided by the OS on the Digital Equipment mini
computer they were using.  There was a similar machine essentiallty
unused they could get time on, so Ken Thompson and Brian Kernighan
began development of a new OS called Unix.  The early versions of Unix
were coded in Macro-11, the assembly language of the DEC machine.
This continued through Unix v6.  As of v7, C was mature enough to be
used, and most of Unix was rewritten in C.  About 10% of the code was
low level code that talked to the hardware, and was still in Macro-11.
Later versions of C campiled directly to object code, and the
intermediate assembly step went away.

On early Unix systems, the C compiler was CC.  It translated C source
into asembley language for the supported architecture. That was
assembled into object code by AS, the system assembler, and the object
code was combined by LD, the linkage editor, into a finished
executable.  It was possible to interrupt the process at the point
where cc had translated C to Assembler, and hand optimize the assembly
code before continuing the process.

A key point here was that programs were modular.  There would be more
than one C source file making up the completed program, so there
wasn't really a need for inline assembler.  If performance wasn't what
was hoped for, you profiled the C code to see where the problems were,
and rewrote the offending C code, or coded it in  assembler as needed.

High level language development on DOS in BASIC or Pascal tended to be
in one big file, so being able to have Assembler inline was a boon.
______
Dennis


_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to