d****n 发帖数: 1637 | 1 BUILD GSL LIBRARIES FOR Visual studio
1. Launch Visual C++ Studio
2. Open project C:\downloads\gsl-1.8-src\src\gsl\1.8\gsl-1.8\VC8\libgsl.sln
3. Continue with convert, and do a build all
4.Verify that after build is complete, new dll files are generated in
subfolders in
C:\downloads\gsl-1.8-src\src\gsl\1.8\gsl-1.8\VC8\libgsl\Debug-DLL
and
C:\downloads\gsl-1.8-src\src\gsl\1.8\gsl-1.8\VC8\libgslcblas\Debug-DLL
....
more at:
http://www.quantcode.com/modules/smartfaq/faq.php?faqid=94 |
|
|
t****t 发帖数: 6806 | 3 why don't you try the code yourself on an NRVO enabled compiler, e.g. VC8 or
gcc. IamR is right. |
|
b*******t 发帖数: 79 | 4 变量是函数的变量还是全局的呢
函数的变量放在stack,有可能stack overflow. 你最好debug跟踪下
GCC和VC8在stack放了canary word(VC编译的/GS选项) |
|
c*****t 发帖数: 1879 | 5 Finally got it fixed. The new postgresql pre-compiled binary was
created using VC8 instead of MinGW which was used in previous versions,
so are the library files it bundles with it. I was using MinGW and
there are some incompatibilities between these two (particulary for
the vararg I guess). That's why some stuff works fine and some aren't.
Also, postgres re-defines sprintf etc to use its own routine, that's
why I was looking at the wrong place. |
|
t****t 发帖数: 6806 | 6 今天我有点无聊, 就说说这个temp object的事情
如果完全不优化, 实际上这个程序的结果应该是
1 5 4
可以用g++ -fno-elide-constructors 得到这个结果.
调用的顺序是
A::A(&a); // A a
A::A(&c, a); // foo(a) (1)
A::A(&temp1, c); // A(c) (2)
A::A(&ab, temp1); // A ab=... (3)
A::A(&temp2, ab); // return ab (4)
A::A(&d, temp2); // A d=.... (5)
dtor就省掉了.
这5个里面, (1)和(5)是不能省的, 这两个都不是temp object.
1 3 2的结果是把两个temp object省了.
1 2 1的结果是把(3)也省了, 这个叫做named return value optimization. VC8事实上
有这个功能,如果你用release编译,那结果就是1 2 1.
标准是这样写的 |
|
b***y 发帖数: 2799 | 7 ☆─────────────────────────────────────☆
grasssu (没有昵称) 于 (Thu Nov 13 01:27:05 2008) 提到:
VC 8编译下列程序
//求文件大小
ifstream is( "Cars.mkv" );
is.seekg (0, ios::end);
streampos length = is.tellg();
//assert ( length > 0 ); //failed
cout.flags(ios::hex);
cout << length << endl; //输出正的 89c01076, 这个数字换成十进制是
2311065718是正确的。
cout.flags(ios::dec);
cout << length << endl; //输出-1983901578
为什么10进制就是负数呢?我怎么才能得到正确结果?
在ubuntu上面得到结果就是正确的。VC8为什么这么奇怪?
☆─────────────────────────────────────☆
redroof (yellow |
|
g*****u 发帖数: 298 | 8 想打印一个STL container里的元素,但不知道是哪种container,应该怎么写?写成下
面的G++编译不通过,VC8可以。
template
void printContainer(ostream& os, const T& con)
{
T::const_iterator iter = con.begin();
while(iter != con.end())
{
os<<*iter<<" ";
iter++;
}
os<
} |
|
x**n 发帖数: 1055 | 9 的确是传的指针,但是没有用semaphore, boost thread好像没有这个东西吧
是这样的,假设有msvc.dll和mingw.dll
又用VC8.0写了个主程序
typedef struct
{
boost::barrier* brr;
boost::mutex* mtx;
boost::condition* cv;
} BT_PARAM;
main()
{
...
BT_PARAM* bt_param;
bt_param=new BT_PARAM;
接下来初始化bt_param;
接下来loadlibrary,打开msvc.dll和mingw.dll
产生两个线程
boost::thread* t_msvc=new boost::thread(p_msvc,bt_param);
boost::thread* t_mingw=new boost::thread(p_mingw,bt_param);
...
}
然后在msvc.dll.cpp中加上这么一段:
...
bt_param->brr->wait();
...
同样在在mingw.dll.cpp中加上这么一段:
..... 阅读全帖 |
|