size_t, more info

Sylvain Bougerel sylvain.bougerel.devel at gmail.com
Sun Nov 16 11:46:08 UTC 2008


> I think we should use size_t too. And in particular std::size_t. Just
> for the sake a standardization :) (because we gonna include cstddef).
> There is one little thing that might cause a problem. But ppl in boost
> have already fixed that little annoyance with some version of vc++
> prior to vc2005 apparently:
>
>  #if defined _MSC_VER && _MSC_VER <= 1200
>  namespace std
>  {
>      using ::ptrdiff_t;
>      using ::size_t;
>  }
>
> Now we can put this in the code too.
>

OKAY. I will quickly back off on this. This is only present in spirit,
but the rest of the code makes a much throughout usage of
BOOST_NO_STDC_NAMESPACE which basically also defines the above. There
is so many cases in whch BOOST_NO_STDC_NAMESPACE is defined that it's
kind of scary (for dirkumware, stlport, gcc-lib prior to version 3,
msvc prior to version 2005, on sun solaris, with kai, acc, etc, etc,
...)

So, well, for the sake of portability, and yet to retain namespace
scoping, we could:
  namespace std
  {
      using ::ptrdiff_t;
      using ::size_t;
  }
Just for about everything, which appears to work everywhere according
to my understanding of boost code. Yet we can retain the use of
std::size_t, to signify this comes for the standard header, and it's
not something we've declared in our code.

Voila.



More information about the libkdtree-devel mailing list