On 12 February 2011 17:40, Tomalak Geret'kal wrote:
>
> Jonathan,
>
> Isn't that what Remi said? I believe his two solutions were to be employed
> simultaneously, not as an "either/or" set of options. It would certainly
> make sense.
The patch he attached didn't include <cstddef>
It works for GCC because we declare std::size_t in libstdc++'s
<c++config.h> but that's not portable and shouldn't be relied on. I
know some other standard library implementers have chosen to use
something like decltype(sizeof(0)) where they need size_t, so that
they don't need to include <cstddef> or declare std::size_t.
> Also, actually, including stddef.h brings the symbols into the `std`
> namespace *and* the global namespace. See D.5 in 2003.
According to the standard, yes. But not according to reality: many
compilers, g++ included, do not control the C library headers so
<stddef.h> does not declare names in namespace std.
Because of this, we've changed the standard to match reality, the
C++0x draft now says
[ Example: The header <cstdlib> assuredly provides its declarations
and definitions within the namespace
std. It may also provide these names within the global namespace. The
header <stdlib.h> assuredly
provides the same declarations and definitions within the global
namespace, much as in the C Standard. It
may also provide these names within the namespace std. — end example ]