Frustrated trying to be portable

Doug Gwyn gwyn at smoke.brl.mil
Tue Mar 5 02:59:56 AEST 1991


In article <19085 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
>In article <4204 at lupine.NCD.COM> rfg at NCD.COM (Ron Guilmette) writes:
>>In article <15333 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
>>+It isn't necessary.  If the application requires library functions
>>+that are required for a hosted implementation but not for a
>>+freestanding implementation, then it couldn't survive being told
>>+that it is being compiled by a freestanding implementation anyway.
>>I think that you have just assumed away a very real problem.
>>Look.  I have a program which can work, and which can do useful things
>>even within an environment which only conforms to "standalone" subset
>>of ANSI C.
>I have to side with Ron on this one.  Doug is making the assumption
>that the functions =must= exist for the program to be executed.  Yet
>there were quite a few commands, such as 'ls', which have traditionally
>been compiled "standalone" and "hosted" that managed to function quite
>well long before the arrival of ANSI C.  Anyone with access to the old
>source to "ls" can go see for themselves what I am talking about.

In fact I am well aware of AT&T's "standalone" mode for a few commands
such as "ls", and how they are used.  On the other hand, I don't think
you have thought this matter through very well.  If you have an
application that performs useful work in a "freestanding" C environment,
it must directly access hardware registers or be linked with some
nonstandard support library in order to perform I/O etc.  Obviously this
would not be a portable application.  Being nonportable, it can and
would take advantage of system-specific support.  There is nothing to
keep you from using such "hosted" functions as can be made to work in
such an environment.  You don't need to key on any implementation-
provided macro for this, either.

If you think that a single UNIVERSAL macro would have made this a whole
lot easier that it happens to normally be, you are dreaming.  There is
a lot more than that necessary to configure applications to operate in
a multiplicity of non-hosted environments.



More information about the Comp.std.c mailing list