🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2513

Re: Frustrated trying to be portable

#2513
From: Ron Guilmette
Date: Sat, 02 Mar 1991 23:33
37 lines
2332 bytes
In article <15333@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
+In article <4108@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes:
+>Now that this mistake has been made, is there any "common practice" or
+>defacto standard method by which a program can check to see if it is being
+>compiled by/within a "hosted" implementation or a "standalone" implementation?
+
+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.

However I can also get that program to do more things (or better things,
or different things) if I happen to be compiling it within an environment
which qualifies as a full-blown "hosted" implementation of ANSI C.

Unfortunately, x3j11 didn't provide any standard mechanism for the compiler
(or the preprocessor) to tell the program what sort of "standard" C
environment it is being compiled in, so what I have to do (in lieu of
such a feature) is to give this program to various people and instruct
them each to find out if they have a full-blown "hosted" implementation
or only a paltry "standalone" implementation and then to manually edit
the makefile and either include or dis-include -D__HOSTED_STDC__ in CFLAGS
depending upon the specifics of their implementation.

I wish that I did't have to do all that.

-- 

// Ron Guilmette  -  C++ Entomologist
// Internet: rfg@ncd.com      uucp: ...uunet!lupine!rfg
// New motto:  If it ain't broke, try using a bigger hammer.
Technical Details
Message-ID: <4204@lupine.NCD.COM>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!rfg
References: <2956@cirrusl.UUCP> <4108@lupine.NCD.COM> <15333@smoke.brl.mil>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!infopiz!lupine!rfg
From: rfg@NCD.COM (Ron Guilmette)
Newsgroups: comp.std.c
Subject: Re: Frustrated trying to be portable
Keywords: ANSI C, standard library
Message-ID: <4204@lupine.NCD.COM>
Date: 2 Mar 91 23:33:50 GMT
References: <2956@cirrusl.UUCP> <4108@lupine.NCD.COM> <15333@smoke.brl.mil>
Organization: Network Computing Devices, Inc., Mt. View, CA
Lines: 37