initial check in
This commit is contained in:
8
testMultipleDerviation/stdafx.cpp
Normal file
8
testMultipleDerviation/stdafx.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// testMultipleDerviation.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
19
testMultipleDerviation/stdafx.h
Normal file
19
testMultipleDerviation/stdafx.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
|
||||
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// TODO: reference additional headers your program requires here
|
||||
124
testMultipleDerviation/testMultipleDerviation.cpp
Normal file
124
testMultipleDerviation/testMultipleDerviation.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
// testMultipleDerviation.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
class a
|
||||
{
|
||||
public:
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
class b : public virtual a
|
||||
{
|
||||
public:
|
||||
virtual void g() = 0;
|
||||
};
|
||||
|
||||
class c : public virtual a
|
||||
{
|
||||
int n;
|
||||
|
||||
public:
|
||||
c()
|
||||
{ n = 0; }
|
||||
|
||||
virtual void f()
|
||||
{ ++n; }
|
||||
};
|
||||
|
||||
class d : public b, public c
|
||||
{
|
||||
public:
|
||||
// virtual void f()
|
||||
// {
|
||||
// c::f();
|
||||
// }
|
||||
|
||||
virtual void g()
|
||||
{
|
||||
puts( "d::g()" );
|
||||
}
|
||||
};
|
||||
|
||||
class a2
|
||||
{
|
||||
public:
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
class b2 : public virtual a
|
||||
{
|
||||
public:
|
||||
virtual void g() = 0;
|
||||
};
|
||||
|
||||
class c2 : public a2
|
||||
{
|
||||
int n;
|
||||
|
||||
public:
|
||||
c2()
|
||||
{ n = 0; }
|
||||
|
||||
virtual void f()
|
||||
{ ++n; }
|
||||
};
|
||||
|
||||
class d2 : public b2, public c2
|
||||
{
|
||||
public:
|
||||
virtual void f()
|
||||
{
|
||||
c2::f();
|
||||
}
|
||||
|
||||
virtual void g()
|
||||
{
|
||||
puts( "d::g()" );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, _TCHAR* argv[])
|
||||
{
|
||||
const int nAmount = 1000000000;
|
||||
|
||||
d o;
|
||||
d2 o2;
|
||||
|
||||
int nWins1 = 0;
|
||||
int nWins2 = 0;
|
||||
|
||||
for ( ; true ; )
|
||||
{
|
||||
DWORD dwStart = GetTickCount();
|
||||
|
||||
for ( register int n = nAmount; n; --n )
|
||||
o.f();
|
||||
|
||||
DWORD dwDuration = GetTickCount() - dwStart;
|
||||
printf( "Virtual inheritence takes %dms\n", dwDuration );
|
||||
|
||||
|
||||
|
||||
DWORD dwStart2 = GetTickCount();
|
||||
|
||||
for ( register int n = nAmount; n; --n )
|
||||
o2.f();
|
||||
|
||||
DWORD dwDuration2 = GetTickCount() - dwStart2;
|
||||
printf( "Redirection of function %dms\n", dwDuration2 );
|
||||
|
||||
if ( dwDuration2 > dwDuration )
|
||||
++nWins1;
|
||||
else
|
||||
++nWins2;
|
||||
|
||||
printf( "count %d : %d\n\n", nWins1, nWins2 );
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
20
testMultipleDerviation/testMultipleDerviation.sln
Normal file
20
testMultipleDerviation/testMultipleDerviation.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testMultipleDerviation", "testMultipleDerviation.vcproj", "{79D765B8-B695-498E-B1E2-BDC2A6474311}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{79D765B8-B695-498E-B1E2-BDC2A6474311}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
225
testMultipleDerviation/testMultipleDerviation.vcproj
Normal file
225
testMultipleDerviation/testMultipleDerviation.vcproj
Normal file
@@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="testMultipleDerviation"
|
||||
ProjectGUID="{79D765B8-B695-498E-B1E2-BDC2A6474311}"
|
||||
RootNamespace="testMultipleDerviation"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="2"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\testMultipleDerviation.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
Reference in New Issue
Block a user