From 4483499e29b8176b0e4c151fe48f92507b9ad485 Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Fri, 2 Feb 2001 01:59:51 +0000 Subject: [PATCH] Fix typos, add clib namespace issue [SVN r8850] --- microsoft_vcpp.html | 58 ++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/microsoft_vcpp.html b/microsoft_vcpp.html index 8618eba..4e162cb 100644 --- a/microsoft_vcpp.html +++ b/microsoft_vcpp.html @@ -24,7 +24,7 @@ Similar to the portability hints for Borland C++, this page provides hints on some language features of the Microsoft Visual C++ -version 6.0 servicepack 4 compiler. +version 6.0 service pack 4 compiler. Each entry in the following list describes a particular issue, complete with sample source code to demonstrate the effect. @@ -86,18 +86,18 @@ Trying to explicitly instantiate a function template leads to the wrong function being called silently.
-#include <stdio.h>
+#include <stdio.h>
 
-template<class T>
+template<class T>
 void f()
 {
-  printf("%d\n", sizeof(T));
+  printf("%d\n", sizeof(T));
 }
 
 int main()
 {
-  f<double>();      // output: "1"
-  f<char>();        // output: "1"
+  f<double>();      // output: "1"
+  f<char>();        // output: "1"
   return 0;
 }
 
@@ -134,7 +134,7 @@ not work.
 struct A
 {
-  static const int i = 5;      // "invalid syntax for pure virtual method"
+  static const int i = 5;      // "invalid syntax for pure virtual method"
 };
 
@@ -164,13 +164,13 @@ void g() A Template cannot be declared a friend of a class.
-template<class T>
+template<class T>
 struct A {};
 
 struct B
 {
-  template<class T>
-  friend struct A;     // "syntax error"
+  template<class T>
+  friend struct A;     // "syntax error"
 };
 
@@ -181,16 +181,16 @@ templates Defining member templates outside their enclosing class does not work.
-template<class T>
+template<class T>
 struct A
 {
-  template<class U>
+  template<class U>
   void f();
 };
 
-template<class T>
-template<class U>   // "syntax error"
-void A<T>::f()      // "T: undeclared identifier"
+template<class T>
+template<class U>   // "syntax error"
+void A<T>::f()      // "T: undeclared identifier"
 {
 }
 
@@ -204,14 +204,14 @@ their enclosing class. Partial specialization of class templates does not work.
-template<class T>
+template<class T>
 struct A {};
 
-template<class T>
+template<class T>
 struct B {};
 
-template<class T>
-struct A<B<T> > {};  // template class was already defined as a non-template
+template<class T>
+struct A<B<T> > {};  // template class was already defined as a non-template
 
Workaround: In some situations where interface @@ -219,17 +219,17 @@ does not matter, member class templates can simulate partial specialization. -

[template-value] Dependent emplate value parameters

+

[template-value] Dependent template value parameters

Template value parameters whose type depends on a previous template parameter provoke an internal compiler error if the correct syntax (with "typename") is used.
-template<class T, typename T::result_type> // C1001: INTERNAL COMPILER ERROR: ms
+template<class T, typename T::result_type> // C1001: INTERNAL COMPILER ERROR: ms
 c1.cpp, line 1794
 struct B {};
- // (omit "typename" and it compiles)
+ // (omit "typename" and it compiles)
 
 
@@ -239,11 +239,21 @@ struct B {}; The type wchar_t is not a built-in type.
-wchar_t x;  // "missing storage class or type identifier"
+wchar_t x;  // "missing storage class or type identifier"
 
-

+

+Standard Library

+

[clib-namespace] C library names in global namespace instead of std

+

Library names from the <c...> headers are in the global namespace +instead of namespace std.

Workaround:  The header boost/config.hpp +will define BOOST_NO_STDC_NAMESPACE. It can be used as follows: +

# ifdef BOOST_NO_STDC_NAMESPACE
+    namespace std { using ::abs; using ::fabs; }
+# endif
+

Because std::size_t and std::ptrdiff_t are so commonly used, the workaround +for these is already provided in boost/config.hpp.

 


2001-02-01 Jens Maurer