visual-c++

vs2010 c++ tail call optimization

旧时模样 提交于 2020-01-12 14:11:14
问题 Consider the following code: int fac_aux( int x, int res ) { if( x == 1 ) return res; else return fac_aux( x - 1, res * x ); } int fac( int x ) { return fac_aux( x, 1 ); } int main() { int x = fac( 50 ); std::cout << x; return 0; } According to generated asm file everything is ok, tail call is optimized. Try to replace int x = fac( 50 ); with int x = fac_aux( 50, 1 ); Strange enough, but tail call optimization is disappeared. As far as I remember there was no such a strange compiler behaviour

What is the equivalent of v4sf and __attribute__ in Visual Studio C++?

泪湿孤枕 提交于 2020-01-12 10:47:02
问题 typedef float v4sf __attribute__ ((mode(V4SF))); This is in GCC. Anyone knows the equivalence syntax? VS 2010 will show __attribute__ has no storage class of this type, and mode is not defined. I searched on the Internet and it said Equivalent to __attribute__( aligned( size ) ) in GCC It is helpful for former unix developers or people writing code that works on multiple platforms that in GCC you achieve the same results using attribute ( aligned( ... ) ) See here for more information: http:/

Installing MS debug DLLs for remote debugging

隐身守侯 提交于 2020-01-12 08:27:10
问题 I have a .NET app that I would like to install on a VM for remote debugging purposes. The app uses a native VC++ DLL which links to MFC and the MSVC runtime libraries via DLL. When I run depends on the VM, it says that the DLL needs the following DLLs: mfc90d.dll msvcm90d.dll msvcp90d.dll msvcr90d.dll msjava.dll Also, it reports the following error: Error: The Side-by-Side configuration information for [dll path] contains errors. This application has failed to start because the application

Installing MS debug DLLs for remote debugging

泄露秘密 提交于 2020-01-12 08:27:10
问题 I have a .NET app that I would like to install on a VM for remote debugging purposes. The app uses a native VC++ DLL which links to MFC and the MSVC runtime libraries via DLL. When I run depends on the VM, it says that the DLL needs the following DLLs: mfc90d.dll msvcm90d.dll msvcp90d.dll msvcr90d.dll msjava.dll Also, it reports the following error: Error: The Side-by-Side configuration information for [dll path] contains errors. This application has failed to start because the application

How to set the keep alive interval for winsock

孤人 提交于 2020-01-12 05:16:09
问题 I am using winsock and TCP. I have set the KeepAlive option as follows int aliveToggle = 1; setsockopt(mySocket,SOL_SOCKET,SO_KEEPALIVE,(char*)&aliveToggle, sizeof(aliveToggle)); But how to specify the Keep aLive time and interval? I am using VC++ running on windows 7. 回答1: Two per-interface registry settings under the key \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Tcpip\Parameters control the behavior of TCP/IP keep-alives: The KeepAliveTime value specifies how long the TCP connection sits

Portability of pthreads-win32 over various windows compilers

回眸只為那壹抹淺笑 提交于 2020-01-12 04:58:18
问题 I'm using pthreads-win32 to allow threading support for windows. I have a cross platform project that uses pthreads and I want to make it work on windows with various compilers and different OS versions. At least, according to the documentation pthreads-win32 should work with MSVC and even MSVC builds provided. But I don't know if the library is tested with latest MSVC compilers like MSVC-2008 and if it is supported under 64bit windows. From Your own experience are you aware of any issues

Portability of pthreads-win32 over various windows compilers

半城伤御伤魂 提交于 2020-01-12 04:58:04
问题 I'm using pthreads-win32 to allow threading support for windows. I have a cross platform project that uses pthreads and I want to make it work on windows with various compilers and different OS versions. At least, according to the documentation pthreads-win32 should work with MSVC and even MSVC builds provided. But I don't know if the library is tested with latest MSVC compilers like MSVC-2008 and if it is supported under 64bit windows. From Your own experience are you aware of any issues

Why does node-gyp (and other stuff) require Visual Studio?

孤街浪徒 提交于 2020-01-12 04:54:28
问题 node-gyp isn't the first thing I've run into requiring it, but this seems odd. I assume this has something to do with building executables or plugins or whatever but is there no dependency smaller than a complete version of Visual Studio or VS Express that can fit the bill? I though you could actually write, build and run .net apps without a copy of VS if you really wanted to. I ask with intent to at least learn some C++ or whatever else it takes while attempting to address the problem

Visual C++ Precompiled Headers errors

邮差的信 提交于 2020-01-12 04:30:40
问题 Update: What are the effects of including stdafx.h in my header files? I started on a C++ project in Linux/Eclipse CDT and imported it into Visual C++/Windows. In Visual C++, I started using precompiled headers to speed up compilation and defined stdafx.cpp and stdafx.h. Here's my stdafx.h #pragma once #include <string> #include <vector> #include <map> ... and my stdafx.cpp #include "stdafx.h" In every .h and .cpp file, I have the following: #pragma once //if in a header file #include "stdafx

map/set iterator not incrementablemap/set iterator not incrementable

走远了吗. 提交于 2020-01-12 04:29:33
问题 Driver::~Driver() { AutoCritSec acsDriverList(m_csDriverList,true); DRIVERLIST::iterator it = m_DriverList.begin(); for(;it!=m_DriverList.end();it++) { if (it->second == this) { m_DriverList.erase(it); it = m_DriverList.begin(); } } } When I compile my program in visual studio 2003, my program behaves well and good. but when i do the same in 2010, then while closing the application i get some error like Expression:map/set iterator not incrementable and when i press to ignore this i get