SUMMARY
The following is based on the Visual C++ version 2.0 README.WRI file:
/W4 Warning Messages from Including WINDOWS.H
Specifying warning level 4 (/W4) when you compile any program that includes
WINDOWS.H may generate many warnings. Most of these are benign warnings
caused by non-standard extensions used in Windows NT header files such as
WINDOWS.H and files that WINDOWS.H includes. To eliminate these warnings,
create a "dummy" header file that uses the #pragma warning directive to
selectively turn off warnings you don't need to see. Then include this
header file in any source file that also includes WINDOWS.H, or use the /FI
compiler option to force its inclusion.
For example:
// FILE NOWARN.H
#pragma warning(disable:4201)
#pragma warning(disable:4214)
//FILE MYMOD.C
#include "NOWARN.H"
#include <windows.h>
void main(void) {}
For further examples, see AFX.H, located in the MFC\INCLUDE subdirectory of
your Visual C++ version 2.0 installation. AFX.H uses #pragma warning to
disable specific level 4 warnings when compiling MFC applications.
Passing Structures by Value
A pass by value of a structure greater than or equal to 4096 (4K) bytes
may cause an access violation if the current stack allocation is exceeded.
If the structure size is greater than or equal to 8192 (8K) bytes, an
access violation is likely unless you ensure that new stack pages are not
being accessed.
The __purecall function
The __purecall function is a special function (defined with C linkage)
that is defined in the default run-time library, and may be called at run
time if there is an error referencing the object's virtual function table.
This will usually happen as a result of a program error. The following
code causes this error:
struct A;
void x(A*);
struct A
{
virtual void f() = 0;
A() { x(this); }
};
struct B : A
{
void f() { }
};
void x(A*p) { p->f(); }
void main()
{
B aB; // calls B::B calls A::A calls
} // x calls A::f (pure virtual function)
Because such errors cannot be caught at compile time, the __purecall
function is called, generating the following run-time error:
runtime error R6025
- pure virtual function call
If an application (such as a device driver) must be compiled without
using the standard run-time libraries (compiler option /Zl or linker
option /NODEFAULTLIB), but requires virtual function calls, you will get
an "undefined symbol" linker error on __purecall. You can work around
this error in one of two ways: