mirror of
https://github.com/boostorg/more.git
synced 2025-02-25 09:20:13 +08:00
Fix typos, add clib namespace issue
[SVN r8850]
This commit is contained in:
parent
d2170a34a6
commit
4483499e29
@ -24,7 +24,7 @@
|
|||||||
Similar to the
|
Similar to the
|
||||||
<a href="borland_cpp.html">portability hints for Borland C++</a>,
|
<a href="borland_cpp.html">portability hints for Borland C++</a>,
|
||||||
this page provides hints on some language features of the Microsoft Visual 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,
|
Each entry in the following list describes a particular issue,
|
||||||
complete with sample source code to demonstrate the effect.
|
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.
|
wrong function being called silently.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void f()
|
void f()
|
||||||
{
|
{
|
||||||
printf("%d\n", sizeof(T));
|
printf("%d\n", sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
f<double>(); // output: "1"
|
f<double>(); // output: "1"
|
||||||
f<char>(); // output: "1"
|
f<char>(); // output: "1"
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
@ -134,7 +134,7 @@ not work.
|
|||||||
<pre>
|
<pre>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
static const int i = 5; // "invalid syntax for pure virtual method"
|
static const int i = 5; // "invalid syntax for pure virtual method"
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -164,13 +164,13 @@ void g()
|
|||||||
A Template cannot be declared a friend of a class.
|
A Template cannot be declared a friend of a class.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A {};
|
struct A {};
|
||||||
|
|
||||||
struct B
|
struct B
|
||||||
{
|
{
|
||||||
template<class T>
|
template<class T>
|
||||||
friend struct A; // "syntax error"
|
friend struct A; // "syntax error"
|
||||||
};
|
};
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -181,16 +181,16 @@ templates</h3>
|
|||||||
Defining member templates outside their enclosing class does not work.
|
Defining member templates outside their enclosing class does not work.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A
|
struct A
|
||||||
{
|
{
|
||||||
template<class U>
|
template<class U>
|
||||||
void f();
|
void f();
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
template<class U> // "syntax error"
|
template<class U> // "syntax error"
|
||||||
void A<T>::f() // "T: undeclared identifier"
|
void A<T>::f() // "T: undeclared identifier"
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
@ -204,14 +204,14 @@ their enclosing class.
|
|||||||
Partial specialization of class templates does not work.
|
Partial specialization of class templates does not work.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A {};
|
struct A {};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct B {};
|
struct B {};
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
struct A<B<T> > {}; // template class was already defined as a non-template
|
struct A<B<T> > {}; // template class was already defined as a non-template
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<strong>Workaround:</strong> In some situations where interface
|
<strong>Workaround:</strong> In some situations where interface
|
||||||
@ -219,17 +219,17 @@ does not matter, member class templates can simulate partial
|
|||||||
specialization.
|
specialization.
|
||||||
|
|
||||||
|
|
||||||
<h3>[template-value] Dependent emplate value parameters</h3>
|
<h3>[template-value] Dependent template value parameters</h3>
|
||||||
|
|
||||||
Template value parameters whose type depends on a previous template
|
Template value parameters whose type depends on a previous template
|
||||||
parameter provoke an internal compiler error if the correct syntax
|
parameter provoke an internal compiler error if the correct syntax
|
||||||
(with "typename") is used.
|
(with "typename") is used.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
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
|
c1.cpp, line 1794
|
||||||
struct B {};
|
struct B {};
|
||||||
// (omit "typename" and it compiles)
|
// (omit "typename" and it compiles)
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -239,11 +239,21 @@ struct B {};
|
|||||||
The type <code>wchar_t</code> is not a built-in type.
|
The type <code>wchar_t</code> is not a built-in type.
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
wchar_t x; // "missing storage class or type identifier"
|
wchar_t x; // "missing storage class or type identifier"
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<h2>
|
||||||
|
Standard Library</h2>
|
||||||
|
<h3>[clib-namespace] C library names in global namespace instead of std</h3>
|
||||||
|
<p>Library names from the <c...> headers are in the global namespace
|
||||||
|
instead of namespace std.<p><b>Workaround:</b> The header <a href="../libs/config/index.htm">boost/config.hpp</a>
|
||||||
|
will define BOOST_NO_STDC_NAMESPACE. It can be used as follows:
|
||||||
|
<pre># ifdef BOOST_NO_STDC_NAMESPACE
|
||||||
|
namespace std { using ::abs; using ::fabs; }
|
||||||
|
# endif</pre>
|
||||||
|
<p>Because std::size_t and std::ptrdiff_t are so commonly used, the workaround
|
||||||
|
for these is already provided in boost/config.hpp.<p>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
2001-02-01 <a href="../people/jens_maurer.htm">Jens Maurer</a>
|
2001-02-01 <a href="../people/jens_maurer.htm">Jens Maurer</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user