Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jan 1996 09:21:14 -0500
From:      "Paul F. Werkowski" <pw@snoopy.mv.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: libraries
Message-ID:  <199601011421.JAA21474@snoopy.mv.com>
In-Reply-To: <199601010704.SAA25177@godzilla.zeta.org.au>
References:  <199601010704.SAA25177@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Bruce" == Bruce Evans <bde@zeta.org.au> writes:


    >> So, <sys/param.h> is present on all systems that have a C
    >> compiler or just systems with compilers that define the 'unix'
    >> macro, or just BSD derived systems?

    Bruce> Of course not.

    >> Does one need

    >> #if defined __FreeBSD__ || defined
    >> __listOfOthersKnownToHaveParam_ ..  #include <sys/param.h> /*
    >> tests for various flavors of BSD go here */ #endif

    Bruce> This is impractical.  The list would have to have a few
    Bruce> thousand systems in it, and you wouldn't work on thise
    Bruce> systems that don't identify themselves.

    >> Offhand, it looks like the OS dependent feature is hidden in an
    >> OS dependent file.  It seems to me that the compiler ought to
    >> emit the root feature list in some standard way so that codes
    >> can have some predictable behaviour.

    Bruce> This is impractical.  The feature list would have to have a
    Bruce> few thousand flags in it, and wouldn't work on those
    Bruce> systems that don't support it.

    Bruce> The correct method to handle this is to generate the
    Bruce> feature lists on the fly like gnu autoconf does.  However,
    Bruce> this is too much trouble for a port.  Just use `#if 0',
    Bruce> perhaps with a comment, or

    Bruce> #ifdef
    Bruce> this_is_unportable_and_I_am_too_lazy_to_make_it_portable

    Bruce> or the original

    Bruce> #ifndef __FreeBSD__

    Bruce> The latter has the advantage that it is usually spelled
    Bruce> consistently so you can find it easily.

I agree. This is also contrary to the nifty /usr/share/doc/handbook
and previous comments in this thread which advise that __FreeBSD__
compiler generated feature should be used only rarely and that the
"proper" way to test for BSDism's is to test for the BSD feature,
which presupposes that one already knows enough about the environment
to include <sys/param.h>, which looks like the meta-circular screw 
at work. Testing against __FreeBSD__ then becomes the easiest way
to get a port running, and also leads to possible misuse unless one
has experience or reference into what features do or do not exist
on the various other OS flavors. Mods then get maybe sent back to
the original author who is asked to merge in changes he probably
cannot test and the circle repeats. This all results in a horrific
nest of ifdefs that are near impossible to fathom.

Well, sorry to protract this discussion into beating something that
is already dead. It probably belongs in 'ports' and not 'hackers'
anyway.

Best wishes for a pro$perou$ new year to all.
Paul






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199601011421.JAA21474>