dave06a at dunfield.com
Sun Jun 3 07:13:54 CDT 2007
> > Portable only if you assume BYTES are 8 bits (unsigned) now days.
> This is just a modern form of "all the world's a VAX". It's
> approximately as necessary for "portable" code now as assuming you're
> on a VAX was for "portable" code then - and for approximately the same
> value of "portable" (not one I think really deserves the name, but
> that's a different issue).
I don't agree ... "all the world's a VAX" is narrowing your "portable"
program to variants of a specific architecture. Assuming that a byte
has at least 8-bits covers the vast majority of general purpose CPU
architectures (past and present).
Sure there are examples of non-byte machines, however the truth is that
if you encounter a machine which runs code, chances are very high that
it uses an 8-bit byte. Saying that programs "isn't portable" because it
assumes 8-bit bytes is only slightly less narrow than saying that programs
are not portable because they don't operate on machines that don't run code.
There's no such thing as perfect portability, and there will always be
machines that won't run your program "as is". Varying degrees of
modification will be required to do so ranging from tweaking an I/O
call, to full rewrite, and in some cases, complete redesign from the
ground up. The whole thing about portability is trying to minimize the
work required to move a program without introducing excessive operational
overhead. Accomodating "any size" byte will in most cases cause a
substantial overhead with very little gain in portability.
To write code - any code, you need to have assumptions about the system
it will run on. For portability we try establish a set of assumptions
with broad enough scope to allow us to work, and which applies to the
widest varity of architectures. An 8-bit byte is a reasonable assumption
regarding the majority of both modern and classic computer systems.
I agree that in past days, "all the world's a VAX" was a reasonable
assumption, because it was required (due to the lack of portable tools
and development environments) in order to achieve a broad enough base
of assumptions to write meaningful programs. But I do not agree that
"all the world's and 8-bit byte" is anywhere near as equally restrictive
an assumption, hence the value of "portable" is nowhere near the same.
dave06a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools: www.dunfield.com
com Collector of vintage computing equipment:
More information about the cctech