Richard Heathfield said:
Martin said:
There are a few. See
http://www.peren.com/pages/cvsa_isocvpl.htm
Notable by their absence from that (very short) list are Microsoft C, Intel
C, Borland C, gcc, Comeau C, and of course lcc.
Absence from that list does not itself imply non-conformance; it means
they haven't been officially verified (which I'm sure costs $$$). That
said, of course, none of those implementations _are_ conforming.
....except, I'd been under the impression that Comeau C is (it's just
the compiler, not the library, right)? Can anyone confirm/contradict
this?
Until at least Microsoft C and gcc are C99-conforming there seems no point
in trying to write portable, C99-dependent code.
I'm not convinced that's the case (though I avoid doing so, myself).
I suspect we've been a bit spoiled on C90, in that it's one of the few
standards that actually is completely implemented on a large
scale. C++, for instance, has only one complete implementation as far
as I'm aware. The c.l.c++ folks don't say "don't write C++98/03,
because there are no conforming implementations"; they simply use the
portably subset and get on with life (this is not too bad, since the
only missing feature I'm aware of is template exporting).
Those who've had to deal with HTML and CSS, of course, have had to
quickly abandon any ideas of simply writing conformant HTML code:
there are large portions of both standards (regardless of what level
of CSS you choose) that are simply not implemented correctly in enough
browsers to justify their use. Professional web developers who are
interested in standards conformance still have to learn the dance of
what works and what doesn't, and restrict themselves to that
subset. The vast majority of web developers will also add the common
extensions that remain fairly portable despite lack of
standardization (most of them don't give a rat's ass for the W3C
standards anyway).
It doesn't seem unreasonable, then, when certain _portions_ of
functionality specific to the C99 standard reach high levels of
portability, to take advantage of them. Indeed, when certain
extensions that aren't in any standard are widespread, there's nothing
really wrong with using them, either (though they may be offtopic
here). The standard, contrary to some claims, does not define
portability (otherwise we wouldn't even be having this discussion); it
defines a target for implementors to hit if they wish to be
portable. Other targets can co-exist, and sometimes vendors rebel
against the official standard and collectively implement a de facto
one instead.
It seems to me that // comments were widely portable long before C99,
and that one may generally depend on stdint.h and snprintf (thank
God). Inline is widely implemented, but often with significantly
different semantics from C99 (usually based on C++ semantics, I
think), but one can achieve portability with "static inline".
VLAs are probably pretty portable, too, if you similarly stick to a
portable subset of the semantics; and it may be that compound literals
are too, with certain caveats, and if one sticks to treating them as
const-qualified.
Of the above, the only ones I really take advantage of are stdint.h
and snprintf, and maybe occasionally "static inline"; I suspect most
regulars here probably write code that takes advantage of these as
well. These are attractive because they offer significant benefit at
low cost: they are easily worked around or implemented on
implementations that lack them (well, except maybe snprintf, but the
alternatives are too impractical to accept; I'd rather implement my
own snprintf or facilities implementing a subset of its functionality,
than to do without, when it's needed).