cf5-opt is configured for windows.

_.cpp is updated for more options.
Also a test is done on implicite copy constructor generation for a derived
class.
This commit is contained in:
2013-06-22 22:55:32 +04:00
parent 543a2948a7
commit 58b05cd1f4
4 changed files with 145 additions and 22 deletions

14
_.cpp
View File

@@ -1,18 +1,18 @@
/* Check cf5-opt.vim defs.
VIM: let g:lcppflags="-std=c++11 -O2"
VIM: let g:cppflags=g:boost.g:tbb.g:tbbmalloc.g:tbbmproxy
VIM: let g:ldlibpath=g:boostld.g:tbbld
VIM: let g:cf5output=0
VIM: let g:lcppflags="-std=c++11 -O2 -pthread"
VIM: let g:wcppflags="/O2 /EHsc /DWIN32"
VIM: let g:cppflags=g:Iboost.g:Itbb
VIM: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc.g:tbbmproxy
VIM: let g:ldlibpath=g:Bboost.g:Btbb
VIM: let g:argv=""
VIM-: let g:cf5output=0
*/
#include <iostream>
#include <exception>
int main ( void )
{try{
return 0;
}
catch ( const std::exception& e )

View File

@@ -6,26 +6,55 @@ function! s:SetUpLibrariesLinux()
"
" BOOST
"
let g:boostdir=g:srcdir . "/boost_1_53_0"
let g:boostdir=g:srcdir."/boost_1_53_0"
let g:boostinc=g:boostdir
let g:boostlib=g:boostdir . "/lib-amd64/lib"
let g:boostld=":".g:boostlib
let g:boost=" -I".g:boostinc." -L".g:boostlib"
let g:boostlib=g:boostdir."/lib-amd64/lib"
let g:boostbin=g:boostlib
let g:Bboost=g:boostbin.":"
let g:Iboost=" -I".g:boostinc
let g:Lboost=" -L".g:boostlib
"
" Intel TBB
"
let g:tbbdir=g:srcdir . "/tbb41_20130116oss"
let g:tbbinc=g:tbbdir . "/include"
let g:tbblib=g:tbbdir . "/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21"
let g:tbbld=":".g:tbblib
let g:tbb=" -I".g:tbbinc." -L".g:tbblib." -ltbb"
let g:tbbdir=g:srcdir."/tbb41_20130116oss"
let g:tbbinc=g:tbbdir."/include"
let g:tbblib=g:tbbdir."/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21"
let g:tbbbin=g:tbblib
let g:Btbb=g:tbbbin.":"
let g:Itbb=" -I".g:tbbinc
let g:Ltbb=" -L".g:tbblib." -ltbb"
let g:tbbmalloc=" -ltbbmalloc"
let g:tbbmproxy=" -ltbbmalloc_proxy"
endfunction
function! s:SetUpLibrariesWindows()
call s:SetUpLibrariesLinux()
"
" the root of all 3pty libraries
"
let g:srcdir=$HOME . "\\src"
"
" BOOST
"
let g:boostdir=g:srcdir."\\boost_1_53_0"
let g:boostinc=g:boostdir
let g:boostlib=g:boostdir."\\stage\\win64_vc12\\lib"
let g:boostbin=g:boostlib
let g:Bboost=g:boostbin.";"
let g:Iboost=" /I\"".g:boostinc."\""
let g:Lboost=" /LIBPATH:\"".g:boostlib."\""
"
" Intel TBB
"
let g:tbbdir=g:srcdir."\\tbb41_20121003oss"
let g:tbbinc=g:tbbdir."\\include"
let g:tbblib=g:tbbdir."\\lib\\intel64\\vc11"
let g:tbbbin=g:tbbdir."\\bin\\intel64\\vc11"
let g:Btbb=g:tbbbin.";"
let g:Itbb=" /I\"".g:tbbinc."\""
let g:Ltbb=" /LIBPATH:\"".g:tbblib."\" tbb.lib"
let g:tbbmalloc=" tbbmalloc.lib"
let g:tbbmproxy=" tbbmalloc_proxy.lib"
endfunction
function! SetUpLibraries()

View File

@@ -1,7 +1,8 @@
/* Check cf5-opt.vim defs.
VIM: let g:lcppflags="-std=c++11 -O2"
VIM: let g:cppflags=g:tbb." -ltbbmalloc -ltbbmalloc_proxy"
VIM: let g:ldlibpath=g:tbbld
VIM: let g:lcppflags="-std=c++11 -O2 -pthread"
VIM: let g:cppflags=g:Iboost.g:Itbb
VIM: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc
VIM: let g:ldlibpath=g:Bboost.g:Btbb
*/
#include <tbb/enumerable_thread_specific.h>
#include <tbb/task_scheduler_init.h>
@@ -10,11 +11,20 @@ VIM: let g:ldlibpath=g:tbbld
#include <exception>
#include <vector>
/*
* Conclusion:
* The first task_sheduler_init is configuring number of threads in
* the thread pool. If the task scheduler initialised implicitly then
* the number of threads is the number of cores. To ensure uncomment
* the commented line below.
*/
int main ( void )
{try{
std::vector<int> v(1024*1024*1024);
tbb::task_scheduler_init init3(20);
std::vector<int> v(1024*1024);
//tbb::enumerable_thread_specific<int> count;
tbb::task_scheduler_init init3(5);
tbb::task_scheduler_init init(10);
tbb::task_scheduler_init init2(1);
tbb::enumerable_thread_specific<int> count;

View File

@@ -0,0 +1,84 @@
/* Check cf5-opt.vim defs.
VIM: let g:lcppflags="-std=c++11 -O2 -pthread"
VIM-: let g:cppflags=g:Iboost.g:Itbb
VIM-: let g:ldflags=g:Lboost.g:Ltbb.g:tbbmalloc.g:tbbmproxy
VIM-: let g:ldlibpath=g:boostld.g:tbbld
VIM-: let g:cf5output=0
*/
/*
* Conclusion:
* Per C++ standard since Son doesn't have explicitely defined copy
* assignement operator the an implicite one is generated which call
* Base::operatro = () as a result overriden operator in the Son is not
* called.
*/
#include <iostream>
#include <exception>
class Base
{
public:
int b;
virtual Base &operator=(const Base & o)
{ std::cout << "Base" << std::endl; b=o.b; return *this; };
};
class Derived : public Base
{
public:
int d;
virtual Base &operator=(const Base &)
{ std::cout << "Derived 1" << std::endl; return *this;};
virtual Derived &operator=(const Derived &)
{ std::cout << "Derived 2" << std::endl; return *this;};
};
class Son : public Base
{
public:
int d;
virtual Base &operator=(const Base &)
{ std::cout << "Son" << std::endl; return *this;};
};
int main ( void )
{try{
Derived d1, d2;
d1.b = 0;
d2.b = 1;
d1.d = 0;
d2.d = 1;
Base * b1 = &d1;
Base * b2 = &d2;
*b1 = *b2;
std::cout << d1.b << d1.d << std::endl;
d1 = d2;
Son s1, s2;
s1 = s2;
return 0;
}
catch ( const std::exception& e )
{
std::cerr << std::endl
<< "std::exception(\"" << e.what() << "\")." << std::endl;
return 2;
}
catch ( ... )
{
std::cerr << std::endl
<< "unknown exception." << std::endl;
return 1;
}}