Re: assembly in future C standard
- From: jacob navia <jacob@xxxxxxxxxxxxxxxx>
- Date: Thu, 02 Nov 2006 12:22:40 +0100
Richard Bos a écrit :
jacob navia <jacob@xxxxxxxxxxxxxxxx> wrote:
sjdevnull@xxxxxxxxx a écrit :
jacob navia wrote:
Assembly is quite portable between OSes, but not within
different processors
Seems like you're using an odd definition of "portable" here. On
common platforms assembly is not portable between different
compilers/assemblers on the same OS and architecture, let alone between
OSes. Certainly on a single architecture it's possible to write an
assembler that runs under many OSes, but having just one standard
assembly language even in one OS is _not_ the current state of the
world on everyday architectures--witness the x86 example I gave in the
message you replied to.
Since Mac OS, Windows, Linux and Solaris all run the gcc compiler
and since that compiler has an assembler, using that assembler
makes your code portable to any of those architectures.
Oh, right? So calling interrupt 20h will do the same thing under MS-DOS
that it does under MS-Windows? Int 13 can be used to read the disk
allocation tables under Linux? Or are you perhaps limiting yourself to a
severely restricted sub-set of that assembly code?
(Note also that you contradict yourself, since MacOS, MS Windows, and
Solaris may all sometimes use gcc, they typically run on different
processors; so according to your previous post, quoted above, assembly
would not be portable across those three, while here you claim that it
should be.)
Richard
What is portable is the same processor opcodes, not the interrupts,
not the calls to some specific procedure. Portable assembly is,
for instance, a package to calculate with floats 350 bits
wide, or another package to implement bignums. Those packages do not
use any OS dependent features, and even if written entirely
in assembly language they are portable to any OS that supports the
same processor.
The inputs are standard, the outputs are well defined, they are portable
across any processor that implements the x86 instruction set.
Obviously interrupts (supervisor calls, system() etc)are not portable.
This is the same as C. C is portable but
system("ls");
will work in Unix and not in windows.
.
- Follow-Ups:
- Re: assembly in future C standard
- From: CBFalconer
- Re: assembly in future C standard
- Prev by Date: Re: assembly in future C standard
- Next by Date: Re: string search?
- Previous by thread: Re: assembly in future C standard
- Next by thread: Re: assembly in future C standard
- Index(es):
Relevant Pages
|
|