E
Eric Sosman
A more recent language made a pretty serious attempt to
produce exactly the same result on all machines; "write once,
run anywhere" was its slogan.
good
Its designers had to abandon
that goal almost immediately, or else "anywhere" would have
been limited to "any SPARC." Moral: What you seek is *much*
more difficult than you realize.
i see the only difficulty some computer has char not 8 bit...
I'm not sure whether you're speaking of C or of the "more
recent language." The MRE uses a 16-bit `char'. C requires
that `char' have at least 8 bits, but can be (and has been)
implemented on systems where it was wider. Insisting on a `char'
of exactly 8 bits would make C less portable than it is, because
implementations for those machines would be difficult if not
impossible.
all the remain can be in software not in hardware
it will be slow?
Yes, and probably lacking in function. Emulation is very
seldom perfect: You could write a PDP-11 emulator to run on
your favorite Intel chip and run your "PDP-11-defines-C" code
on it -- but will the device drivers work? Fat chance ...
As to your second question: Yes, it would be slow.
[from operation on 8 bit unsigned, one can definite operation on
16 bit, 32 bit etc unsigned
i don't know for signed but i think it will be the same]
can be difficult emulate float point hardware too
but could be easier fixed point software..
Look, Rosario, if you are under the impression that what you
suggest is even remotely practical, allow me to suggest a project.
Take a copy of the C Standard, and search through it for all
instances of implementation-defined, unspecified, or undefined
behavior. For each instance, write down exactly what your ideal C
should do.
If writer's cramp hasn't persuaded you that you're on a wild
goose chase, continue by making a list of a couple hundred C
implementations, and see how many of them conform to your improved
version of the Standard -- that is, see how many of today's C
implementations you want to see purged from the planet. Finally,
tell the maintainers of those implementations that their work has
been a waste and that they should scrap what they've done.