Ed Vogel wrote On 01/31/06 09:06,:
"Jack Klein" <ja*******@spam cop.net> wrote in message
news:ak******** *************** *********@4ax.c om...
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.
--
Er*********@sun .com