惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
雷峰网
雷峰网
罗磊的独立博客
T
The Blog of Author Tim Ferriss
阮一峰的网络日志
阮一峰的网络日志
量子位
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
Cisco Talos Blog
Cisco Talos Blog
Engineering at Meta
Engineering at Meta
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Cloudflare Blog
Know Your Adversary
Know Your Adversary
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
D
DataBreaches.Net
T
The Exploit Database - CXSecurity.com
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
爱范儿
爱范儿
U
Unit 42
Security Latest
Security Latest
M
MIT News - Artificial intelligence
月光博客
月光博客
Scott Helme
Scott Helme
G
Google Developers Blog
有赞技术团队
有赞技术团队
T
Tor Project blog
宝玉的分享
宝玉的分享
Y
Y Combinator Blog
博客园 - Franky
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
The GitHub Blog
The GitHub Blog
V
V2EX
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
Securelist
博客园 - 三生石上(FineUI控件)
Blog — PlanetScale
Blog — PlanetScale
TaoSecurity Blog
TaoSecurity Blog
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed
腾讯CDC
D
Docker
Google Online Security Blog
Google Online Security Blog

博客园 - 飞天名猪

django 定制管理页面外观 模板文件不生效的解决方法 新手上路,django学习笔记(1) 环境部署 Windows7系统命令总结 VC 编程ANSI环境下读写Unicode文件(转载) ICE3.1.1 开发中遇到的问题(四) 发布9个腾讯微博的邀请码 IcePatch2+IceGrid部署的解决方案 ICE 开发中遇到的问题(三) Ice开发中遇到的问题(二) ICE开发中遇到的问题 (一) - 飞天名猪 - 博客园 使用ICE遇到的编译问题 dbf文件结构 判断操作系统的类型 浏览器插件-- Browser Helper Object(BHO) 四 浏览器插件-- Browser Helper Object(BHO) 三 浏览器插件-- Browser Helper Object(BHO) 二 浏览器插件-- Browser Helper Object(BHO) 一 window程序自启动的几种方法(四) windows程序自启动的几种方法(三)系统配置文件
[转载]vc6转2008的一些实践经验 - 飞天名猪 - 博客园
飞天名猪 · 2010-05-28 · via 博客园 - 飞天名猪

首先感谢原文作者分享自己的经验,本人认为这篇文章是很有价值的。

附原文地址:http://blog.sina.com.cn/s/blog_544734b40100dbx1.html

1, 尽量不用"Using namespace".

2, 变量不初始化,然后赋值给其他变量的时候,debug下会弹出assert.

3, 机器太慢,需要更好的配置.

4, 一些定义在2008的系统文件里已经有了.

enum SHIL

{

    SHIL_LARGE = 0,

    SHIL_SMALL = 1,

    SHIL_EXTRALARGE = 2,

    SHIL_SYSSMALL = 3,

    SHIL_USER64,

};

SHIL_LARGE 已经在下面的文件里定义了

D:"Program Files"Microsoft SDKs"Windows"v6.0A"include"shellapi.h

#if (NTDDI_VERSION >= NTDDI_WINXP)

#define SHIL_LARGE           // normally 32x32

#define SHIL_SMALL           // normally 16x16

#define SHIL_EXTRALARGE     2

#define SHIL_SYSSMALL         // like SHIL_SMALL, but tracks system small icon metric correctly

#if (NTDDI_VERSION >= NTDDI_LONGHORN)

#define SHIL_JUMBO           // normally 256x256

#define SHIL_LAST           SHIL_JUMBO

#else

#define SHIL_LAST           SHIL_SYSSMALL

#endif // (NTDDI_VERSION >= NTDDI_LONGHORN)

#endif // (NTDDI_VERSION >= NTDDI_WINXP)

typedef enum _SEARCH_RESTR

{

    SEARCH_ALL = 0,已经在下面的文件里定义了"D:"Program Files"Microsoft SDKs"Windows"v6.0A"include"winioctl.h"

    SEARCH_CHAT,

    SEARCH_FILE,

}SEARCH_RESTR;

解决办法:可以加一个namespace

5, warning C4996: '_itow': This function or variable may be unsafe. Consider using _itow_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

warning C4996: 'gmtime': This function or variable may be unsafe. Consider using gmtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

warning C4996: 'wcstok': This function or variable may be unsafe. Consider using wcstok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

_s版本的字符串处理函数更安全.

6, wchar_t作为c++的内部类型,不能用unsigned short代替.可以通过下面的开关来设置Whether treat wchar_t as Build-in Type.

 Property --> C/C++ --> language --> Treat wchar_t as Build-in Type (NO).

7,return NCStr ( c_str() + nFirst, end() ); --> return NCStr ( c_str() + nFirst, length() - nFirst );

迭代器被封装了,所以这时候对CRangeT ( pointer pHead = 0, pointer pTail = 0 )CRangeT ( pointer pHead, int nLen ),产生歧义,不知道该用哪个构造函数

8,    enum EInsertAfter

    {

        e_iaFirst           = TVI_FIRST,

        e_iaLast            = TVI_LAST,

        e_iaSort            = TVI_SORT,

    };

 -->

   enum EInsertAfter

    {

        e_iaFirst           = (int)TVI_FIRST,

        e_iaLast            = (int)TVI_LAST,

        e_iaSort            = (int)TVI_SORT,

    };

#define TVI_ROOT                ((HTREEITEM)(ULONG_PTR)-0x10000)

#define TVI_FIRST               ((HTREEITEM)(ULONG_PTR)-0x0FFFF)

#define TVI_LAST                ((HTREEITEM)(ULONG_PTR)-0x0FFFE)

#define TVI_SORT                ((HTREEITEM)(ULONG_PTR)-0x0FFFD)

这几个值是指针,不是整型

9, _L("SettingFailed")) ). _L宏没有定义

10, 取函数指针 CXmpp::IQRoomList --> &CXmpp::IQRoomList

11, 函数必须有返回值,定义变量必须指定类型

12, error C2471: cannot update program database 'e:"projects"connect"c5_hz_2008"obj"release"triext"vc90.pdb

打补丁VS90-KB946040.exe.

13,     CComQIPtr< IHTMLDocument2> pDoc;

MSHTML::IHTMLDocument3Ptr pDoc3 = NULL;

pDoc3 = pDoc; 这里2008不能通过编译,待研究.

14, time_t的定义,

localtime(&block_header.m_tDate);

vc632位的:

#ifndef _TIME_T_DEFINED

typedef long time_t;        

#define _TIME_T_DEFINED    

#endif

vc2008默认是64:

#ifndef _TIME_T_DEFINED

#ifdef _USE_32BIT_TIME_T

typedef __time32_t time_t;     

#else

typedef __time64_t time_t;     

#endif

#define _TIME_T_DEFINED        

#endif

15, class CAniFrame : CWindowImpl< CAniFrame >

vc6默认是public继承

vc2008默认是private继承

17 1>."res"Installer.exe.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the path specified.

causeInstaller.exe.manifest不知道什么时候被加到resource里去了,删除即可。

18, typedef int (WINAPI* PTGetSSOTicketProc)(CSSOSink* pSink, HWND hParent, LPTSTR lpszSiteURL, BOOL bForce=FALSE, LPVOID lpData=NULL);

指向函数的指针不允许参数带默认值

19, For循环内部定义的变量作用域只在循环体内部.

         for(int i=0;i<100;++i){}; j = i;   (illegal)

         int i; for(i<0;i<100;++i){}; j = i;   (ok)

         for(int i=0;i<100;i++){}  for(i=0;i<100;i++){} (illegal)

         for(int i=0;i<100;i++){}  for(int i=0;i<100;i++){} (ok)

20, STL里的iterator 不要直接传递给指针。或把指针传给iterator

         string s; char *p = s.begin(); (illegal)

         string s; char *p = const_cast<char *>(s.c_str()); (ok)

//below example is illegal

         map<LPCTSTR,LPTSTR>::iterator p = NULL;

         p = m_mpUrlParams.find(lpTempID);

         if(p != NULL){…}

//below example is right

         map<LPCTSTR,LPTSTR>::iterator p = m_mpUrlParams.find(lpTempID);

         if(p != m_mpUrlParams.end()){…}

21, 在你涉及到一个在 template(模板)中的 nested dependent type name(嵌套依赖类型名)的任何时候,你必须把单词 typename 放在紧挨着它的前面

CTLMap<KEY, ARG_KEY, VALUE, ARG_VALUE>::CAssoc*

CTLMap<KEY, ARG_KEY, VALUE, ARG_VALUE>::NewAssoc() -->typename CTLMap<KEY, ARG_KEY, VALUE, ARG_VALUE>::CAssoc*

CTLMap<KEY, ARG_KEY, VALUE, ARG_VALUE>::NewAssoc()

ex:

template<typename C> // this is valid C++
void print2nd(const C& container)
{

     if (container.size() >= 2)

    {

         typename C::const_iterator iter(container.begin());
        ...
     }
}

22, typedef 必须是public才能被外界访问到.

23, 在如下情况下必须明确指定模板参数

template< class TBase, class TWinTraits = CControlWinTraits >

class UI_EXPORT CTriSimplestWndImpl : public CWindowImpl<CTriSimplestWndImpl , TBase, TWinTraits>

{

public:

         BEGIN_MSG_MAP(CTriSimplestWndImpl)

         END_MSG_MAP()

};

template< class TBase, class TWinTraits = CControlWinTraits >

class UI_EXPORT CTriSimplestWndImpl : public CWindowImpl<CTriSimplestWndImpl<TBase,TWinTraits>, TBase, TWinTraits>

{

public:

         BEGIN_MSG_MAP(CTriSimplestWndImpl)

         END_MSG_MAP()

};

还有很多warning应该去关注,争取做到无warning