Re: compile detection of powf, etc
- From: Eric Sosman <eric.sosman@xxxxxxx>
- Date: Tue, 31 Jan 2006 09:48:15 -0500
Ed Vogel wrote On 01/31/06 09:06,:
> "Jack Klein" <jackklein@xxxxxxxxxxx> wrote in message
> news:akptt19ji7cjbnmthpldau5o5l20qttijf@xxxxxxxxxx
>
>>I don't agree with the statement that the "compiler and the library
>>are commonly separate". I don't know of a single other implementation
>>other than some gcc variants where this is so.
>>
>>Do you know of any others?
>>
>>--
>
> Jack,
>
> All HP C compiler implementations (HP-UX, Tru64 UNIX, and OpenVMS)
> ship separately from the libraries. The libraries ship with the O.S. as
> they
> are needed by many applications that do not require the compilers.
That's usually the case, but distribution and
integration are different things. The macros defined
by the compiler and headers must correctly describe
the library and the operating environment, or else
"the implementation" is non-conforming. The Standard
has no notion (in hosted systems) of separating the
compiler from the library, just as it has no notion
of separating the preprocessor from the rest of the
compiler. Real systems are often built from modules,
but the Standard speaks only of the integrated whole.
... which isn't to say that the compilers and
libraries are always properly integrated. As Ken
Thompson pointed out, a compiler that defines
__STDC_VERSION__ as 199901L might find itself deployed
with a library that doesn't conform to C99. That's a
bit like deploying tires of different sizes on the
left and right sides of your car; none of the tires
is "wrong" in and of itself, but the combination of
mismatched sizes is invalid anyhow.
From the programmer's perspective, I think you must
trust __STDC_VERSION__, just as you trust longjmp().
A C99 compiler mis-deployed with a C89 library will
deceive you; equally, a compiler that uses one flavor of
compiler magic in its setjmp() will produce code that
is likely to fail if deployed with a library whose
longjmp() expects a different sort of magic. Sometimes
it will turn out that your trust is misplaced; that's
the way things are in an imperfect world. But what's
the alternative? Run a complete conformance test suite
before starting each compilation? Trust the compiler,
I say, and realize that it may lie very occasionally.
--
Eric.Sosman@xxxxxxx
.
- References:
- compile detection of powf, etc
- From: Marco
- Re: compile detection of powf, etc
- From: Eric Sosman
- Re: compile detection of powf, etc
- From: Keith Thompson
- Re: compile detection of powf, etc
- From: Jack Klein
- Re: compile detection of powf, etc
- From: Ed Vogel
- compile detection of powf, etc
- Prev by Date: Re: Help! Need to make my own color...
- Next by Date: Re: Question about the clc string lib
- Previous by thread: Re: compile detection of powf, etc
- Next by thread: Re: compile detection of powf, etc
- Index(es):
Relevant Pages
|