On 06/04/2010 11:48 AM, [email protected] wrote:
>
> Comment #3 on issue 195 by jmccaskey: common.h should not have "using
> namespace std;"
> http://code.google.com/p/protobuf/issues/detail?id=195
>
> Ok, it looks like this *is* a Visual C++ bug. I can simplify my test
> program down to
> the following and the errors still occur and the using namespace std
> does appear to
> leak out of it's proper scope. I can't reproduce the same behavior with
> gcc on osx.
>
> I'll go look for possible VC++ hotfixes that may address the issue.
> Still might be
> nice if this could be avoided for VC++ users.
/me is increasingly in favor of disallowing all use of using namespace *
in his own code, even inside of other namespaces.
> // test.cpp : Defines the entry point for the console application.
> //
>
> #include <string>
>
> namespace google {
> namespace protobuf {
>
> using namespace std;
>
>
> namespace internal {
>
> template <bool>
> struct CompileAssert {
> };
>
> } // namespace internal
>
> }
> }
>
>
> template< class T >
> void swap( T &a, T &b )
> {
> T tmp = a;
> a = b;
> b = tmp;
> }
>
>
> int _tmain(int argc, _TCHAR* argv[])
> {
> int one = 1;
> int two = 2;
>
> swap( one, two );
> return 0;
> }
>
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.