Well, I'll consider myself suitably admonished.
Yes, a user of a
language *should* learn its rules but I would say that for an
occasional user there seem to be lots of them to learn. Fine if you
are using C every day; for intermittent use it is tempting to stick
to the parts one is familiar with.
C is a little too complicated a language for intermittent use. A
higher-level language that protects you from some of the details might
be a better idea.
C is arguably no longer one language as it was in the early days, and
the new versions are far from simple to judge by the many discussions
about detailed differences that I have seen.
The C standard left many things implementation-defined and undefined,
and therefore allows considerable variation in how the language is
implemented. However, this variation was only formalized by C90, it was
not created by it. K&R allowed a wider range of variations than C90 did,
and was far less clear about what variations were allowed. Since it
wasn't a standard, implementors didn't feel constrained to follow K&R
precisely - they frequently treated it more as a source of inspiration,
rather than as a precise specification of how the language works.
The new standard was, in itself, yet another new version of C, and more
different from many existing implementations than they were from each
other. However, it was rapidly and widely adopted by many people who
were sick and tired of the hassle of dealing with the many different
variations on K&R C. As a result, the long term effect was actually a
substantial reduction in the variety of different implementations.
Now, C99 never succeeded in fully replacing C90, so it increased the
diversity of C. C2011 will probably have the same effect, for much the
same reasons. On top of that, C2011 officially made several features
optional, which means that we now have small family of different
standard versions of C. Still, I can't help wondering if your feeling
that C was far more united in "the early days" has more to due with
nostalgia than with reality. What specific things give you the feeling
that C is more diverse now?
Some folk here won't like my next comment (asbestos drawers on...)
but it is intended to express a viewpoint: Ritchie's C used to be (or
at least appear to be) an admirably straightforward language but for
a number of reasons has become a set of similar languages with highly
complex rules about details - a domain for language lawyers, if you
like. That's not meant to be a criticism of anyone, just a comment on
how the versions of C can seem to an occasional user.
The complex rules about details replaced, for the most part,
corresponding ambiguities in the K&R specification. In the days before
the standard, a portability guru had to be familiar with all the
different ways different real-world implementations interpreted (or
mis-interpreted or extended) what K&R said. Nowadays, a portability guru
has the much simpler task of being familiar with all the different
variations allowed by the words of the standard. It seems more
complicated, but only because the details are fully specified; the
actual variety of possibilities that need to be considered is much smaller.
In fact I do use C fairly often but tend to stick to what I know or
what the compiler I have available will accept. Compilers don't
always implement standard C and hence add to the potential confusion.
Almost every compiler made in the last decade has a mode that is nearly,
if not fully, conforming to either C90 or C99, and many have both modes.
....
This is a great case in point: folks here seemed to know that
<limits.h> would be available and it was on both compilers, even the
old 16-bit one. Does that knowledge come from experience of dealing
with similar issues or from specific documentation? If the latter,
which documents?
That's such basic information that I no longer remember the
circumstances under which I first learned about it; it probably happened
at least 20 years ago. The place I would go to now, to get information
about similar things (such as the new headers provided by C2011) would
be the latest free draft version of the C2011 standard:
<
http://open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>. It's nearly as
good, for almost all purposes, as the official standard, and it's a lot
cheaper. Each section from 7.2 to 7.30 corresponds to one of the
standard headers. 7.10 describes <limits.h>.