J
James Kanze
[snipped conversation re. C <file.h> vs. C++ <cfile> headers.]
The symbols to which you're referring are allowed to be there,
and have been allowed for a long time. At least cstdlib gives
me the choice between ::size_t and std::size_t.
It shouldn't. According to the current standard, <cstddef>
I use POSIX quite a bit, and haven't had any problems with it
(aside from the non-C++-specific friction, e.g. re. dlsym
returning void*). Platform-specific names (e.g. ::ssize_t)
are no less plentiful in stdlib.h than in cstdlib.
Where is that documented? In what standard? (I know that it's
often the case---in many cases, the implementation of the <c...>
header is simply to include the <...h> header, wrapping it in
extern "C" {}. Which isn't conform, of course, but everyone
does it.) And is it ::ssize_t or std::ssize_t? And isn't it
confusing to have to remember std::size_t, but :os_t?
In my admittedly anecdotal experience, it *is* vanishingly
rare, and *does* correlate strongly with the quality of the
programmer's work in other respects; I apparently hold the
minority opinion in c.l.c++, though. I guess we'll agree to
disagree.
I don't know if your opinion is a minority one or not. It's
certainly valid to prefer the <c...> forms. But prefering the
..h forms is also valid---in addition to the reasons mentionned,
it says right up front that you are using a C header, rather
than trying to pretend otherwise. And since I don't have a
<cunistd> or a <cpthread>. (Basically, I consider the Posix
headers as "standard" for much of what I do, so I'm using a lot
of headers with the .h form and all of their symbols in ::
anyway.)