青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

posts - 101,  comments - 57,  trackbacks - 0
http://www.codeguru.com/forum/showthread.php?t=431298

This problem arises when A 64-bit pointer was truncated to a 32-bit int or 32-bit long.

This warning is only issued when /Wp64 is used.

From MSDN

Quote:

Error Message
'variable' : pointer truncation from 'type' to 'type'

This warning detects 64-bit portability issues. For example, if code is compiled on a 64-bit platform, the value of a pointer (64 bits) will be truncated if it is assigned to an int (32 bits).


See /Wp64

Quote:

Detects 64-bit portability problems on types that are also marked with the __w64 keyword.
/Wp64

/Wp64 is off by default in the Visual C++ 32-bit compiler and on by default in the Visual C++ 64-bit compiler.

Variables of the following types are tested on a 32-bit operating system as if they were being used on a 64-bit operating system:
  • int
  • long
  • pointer
If you regularly compile your application with a 64-bit compiler, you may want to disable /Wp64 in your 32-bit compilations, as the 64-bit compiler will detect all issues. For more information about targeting a Windows 64-bit operating system, see 64-Bit Programming with Visual C++.

To set this compiler option in the Visual Studio development environment
  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
  2. Click the C/C++ folder.
  3. Click the General property page.
  4. Modify the Detect 64-bit Portability Issues property.
To set this compiler option programmatically
  • use Detect64BitPortabilityProblems.

Also, Have a look Rules for Using Pointers.


Quote:
Rules for Using Pointers

Porting your code to compile for both 32- and 64-bit Microsoft® Windows® is straightforward. You need only follow a few simple rules about casting pointers, and use the new data types in your code. The rules for pointer manipulation are as follows.

  1. Do not cast pointers to int, long, ULONG, or DWORD. If you must cast a pointer to test some bits, set or clear bits, or otherwise manipulate its contents, use the UINT_PTR or INT_PTR type. These types are integral types that scale to the size of a pointer for both 32- and 64-bit Windows (for example, ULONG for 32-bit Windows and _int64 for 64-bit Windows). For example, assume you are porting the following code:



    ImageBase = (PVOID)((ULONG)ImageBase | 1);

    As a part of the porting process, you would change the code as follows:



    ImageBase = (PVOID)((ULONG_PTR)ImageBase | 1);

    Use UINT_PTR and INT_PTR where appropriate (and if you are uncertain whether they are required, there is no harm in using them just in case). Do not cast your pointers to the types ULONG, LONG, INT, UINT, or DWORD.



    Note that HANDLE is defined as a void*, so typecasting a HANDLE value to a ULONG value to test, set, or clear the low-order 2 bits is an error on 64-bit Windows.
  2. Use the PtrToLong or PtrToUlong function to truncate pointers. If you must truncate a pointer to a 32-bit value, use the PtrToLong or PtrToUlong function (defined in Basetsd.h). These functions disable the pointer truncation warning for the duration of the call.



    Use these functions carefully. After you convert a pointer variable using one of these functions, never use it as a pointer again. These functions truncate the upper 32 bits of an address, which are usually needed to access the memory originally referenced by pointer. Using these functions without careful consideration will result in fragile code.
  3. Be careful using OUT parameters. For example, suppose you have a function defined as follows:

    void func( OUT PULONG *PointerToUlong );

    Do not call this function as follows:


    ULONG ul;

    PULONG lp;

    func((PULONG *)&ul);

    lp = (PULONG)ul;

    Instead, use the following call:



    PULONG lp;

    func(&lp);

    Typecasting &ul to PULONG* prevents a compiler error, but the function will write a 64-bit pointer value into the memory at &ul. This code works on 32-bit Windows, but will cause data corruption on 64-bit Windows—and it will be subtle, hard-to-find corruption. The bottom line: Do not play tricks with the C code—straightforward and simple is better.
  4. Be careful with polymorphic interfaces. Do not create functions that accept DWORD parameters for polymorphic data. If the data can be a pointer or an integral value, use the UINT_PTR or PVOID type.



    For example, do not create a function that accepts an array of exception parameters typed as DWORD values. The array should be an array of DWORD_PTR values. Therefore, the array elements can hold addresses or 32-bit integral values. (The general rule is that if the original type is DWORD and it needs to be pointer width, convert it to a DWORD_PTR value. That is why there are corresponding pointer-precision types.) If you have code that uses DWORD, ULONG, or other 32-bit types in a polymorphic way (that is, you really want the parameter or structure member to hold an address), use UINT_PTR in place of the current type.
  5. Use the new window class functions. If you have window or class private data that contains pointers, your code will need to use the following new functions:
    • GetClassLongPtr
    • GetWindowLongPtr
    • SetClassLongPtr
    • SetWindowLongPtr
    These functions can be used on both 32- and 64-bit Windows, but they are required on 64-bit Windows. Prepare for the transition by using these functions now.

    Additionally, you must access pointers or handles in class private data using the new functions on 64-bit Windows. To aid you in finding these cases, the following indexes are not defined in Winuser.h during a 64-bit compile:

    • GWL_WNDPROC
    • GWL_HINSTANCE
    • GWL_HWDPARENT
    • GWL_USERDATA
    Instead, Winuser.h defines the following new indexes:

    • GWLP_WNDPROC
    • GWLP_HINSTANCE
    • GWLP_HWNDPARENT
    • GWLP_USERDATA
    • GWLP_ID
    For example, the following code does not compile:

    SetWindowLong(hWnd, GWL_WNDPROC, (LONG)MyWndProc);
    It should be changed as follows:

    SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)MyWndProc);
    When setting the cbWndExtra member of the WNDCLASS structure, be sure to reserve enough space for pointers. For example, if you are currently reserving sizeof(DWORD) bytes for a pointer value, reserve sizeof(DWORD_PTR) bytes.
  6. Access all window and class data using FIELD_OFFSET. It is common to access window data using hard-coded offsets. This technique is not portable to 64-bit Windows. To make your code portable, access your window and class data using the FIELD_OFFSET macro. Do not assume that the second pointer has an offset of 4.
  7. The LPARAM, WPARAM, and LRESULT types change size with the platform. When compiling 64-bit code, these types expand to 64 bits, because they typically hold pointers or integral types. Do not mix these values with DWORD, ULONG, UINT, INT, int, or long values. Examine how you use these types and ensure that you do not inadvertently truncate values.
posted on 2010-07-07 16:28 margin 閱讀(2222) 評論(2)  編輯 收藏 引用

FeedBack:
# re: vs2005把默認(rèn)使用64編譯器,所以指針是64位的。
2010-07-08 12:51 | 陳梓瀚(vczh)
這只是compatible,用警告告訴你“如果換成64位就會有這些錯誤”而已。默認(rèn)還是32的。  回復(fù)  更多評論
  
# re: vs2005把默認(rèn)使用64編譯器,所以指針是64位的。
2010-07-14 11:12 | margin
@陳梓瀚(vczh)
多謝指出...  回復(fù)  更多評論
  

只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


<2025年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用鏈接

留言簿

隨筆檔案

文章分類

文章檔案

收藏夾

常去的壇子

  • CVC電腦病毒論壇
  • 很多人說我是AV,我告訴他們:別瞧不起人,我們也能創(chuàng)造價值
  • 安全焦點
  • 黑客聚集的地方,一般是好酒最多的地方...
  • 看雪論壇
  • 國內(nèi)最強的加密解密論壇,成醉其中經(jīng)常夜不歸宿
  • 驅(qū)動開發(fā)論壇
  • 厭倦了啤的朋友們,來我們來整點白的...痛痛快快的BSOD也好過隔鞋瘙癢!

我的朋友

  • Sen的blog
  • IDE方面資深的受害者...經(jīng)常為一個變量的定義找不著北的痛苦程序員(深表同情)
  • 老羅的blog
  • 良師益友,千年水牛,引擎猛男,分析怪獸,墨鏡酷哥,臺球高手....

搜索

  •  

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲第一偷拍| 99国产精品久久久久久久成人热| 久久国产精品久久国产精品| 欧美国产日韩xxxxx| 久久精品国产成人| 国模一区二区三区| 久久超碰97人人做人人爱| 99riav久久精品riav| 欧美精品免费播放| 亚洲乱码国产乱码精品精98午夜 | 欧美国产在线观看| 久久经典综合| 在线观看国产成人av片| 久久亚洲精选| 美国三级日本三级久久99| 在线免费观看欧美| 欧美高清视频| 欧美日韩亚洲一区二区三区在线| 亚洲性色视频| 亚洲欧美日韩中文视频| 国产综合精品| 亚洲电影在线播放| 欧美日韩久久不卡| 先锋影音一区二区三区| 午夜精品视频在线| 尤物99国产成人精品视频| 欧美va天堂在线| 欧美一区二区大片| 亚洲一区二区三区高清 | 国产精品进线69影院| 亚洲免费综合| 免费成人美女女| 一区二区高清视频在线观看| 黄色成人av网| 男人的天堂亚洲在线| 牛牛国产精品| 国产一区二区看久久| 国产欧美一区二区精品性| 99视频超级精品| 欧美成人午夜免费视在线看片| 亚洲性线免费观看视频成熟| 欧美片在线观看| 亚洲日本一区二区| 免费在线观看精品| 久久久久久久久久看片| 国产精品手机视频| 亚洲一区www| 日韩一本二本av| 欧美另类视频在线| 亚洲美女啪啪| 亚洲日本成人网| 免费在线观看成人av| 红桃视频成人| 久久亚洲风情| 久久久精品日韩欧美| 国内精品久久久久久 | 亚洲高清久久久| 麻豆九一精品爱看视频在线观看免费| 国产一区二区精品| 久久激情网站| 欧美在线视频观看| 狠狠久久亚洲欧美专区| 老司机凹凸av亚洲导航| 久久成人资源| 亚洲欧美一区二区三区在线| 国产精品久久久久久久久久妞妞| 亚洲午夜精品久久久久久浪潮| 99视频精品全国免费| 欧美午夜不卡在线观看免费 | 久久精品国产在热久久 | 99伊人成综合| 国产精品扒开腿做爽爽爽软件 | 亚洲激情第一区| 欧美日韩精品伦理作品在线免费观看 | 欧美成人免费播放| 久久人体大胆视频| 一本一本久久a久久精品综合麻豆 一本一本久久a久久精品牛牛影视 | 久久久久国产精品一区二区| 韩日欧美一区二区| 男人的天堂亚洲| 欧美区二区三区| 欧美亚洲视频| 久热这里只精品99re8久| 日韩亚洲欧美高清| 亚洲女同精品视频| 午夜一级在线看亚洲| 亚洲性av在线| 激情成人亚洲| 免费在线观看一区二区| 欧美一区二区三区四区在线观看地址| 亚洲欧美另类在线观看| 黄色成人av在线| 亚洲精品男同| 国产精品中文在线| 欧美激情性爽国产精品17p| 国产精品白丝av嫩草影院| 99综合在线| 性色av香蕉一区二区| 亚洲激情视频在线| 亚洲一区二区三区在线看 | 亚洲国产裸拍裸体视频在线观看乱了中文 | 久久精彩视频| 欧美激情亚洲综合一区| 亚洲综合色激情五月| 亚洲欧美久久久| 亚洲日本成人在线观看| 亚洲欧美国产一区二区三区| 91久久精品美女高潮| 性8sex亚洲区入口| 亚洲综合不卡| 欧美精品免费播放| 欧美成人三级在线| 狠狠色噜噜狠狠色综合久| 99国内精品| 夜夜爽av福利精品导航| 久久全国免费视频| 久久视频一区二区| 国产欧美日韩视频| 一区二区免费在线观看| 亚洲美洲欧洲综合国产一区| 久久久久久久成人| 久久亚洲精品视频| 国产午夜精品理论片a级探花 | 久久在线播放| 国产精品成人一区二区艾草| 亚洲国产精品久久久久秋霞不卡| 国产亚洲精品自拍| 亚洲网站在线看| 一级成人国产| 欧美人妖在线观看| 亚洲精品国产精品国产自| 欧美日韩国产成人在线观看| 男女精品视频| 娇妻被交换粗又大又硬视频欧美| 亚洲专区欧美专区| 午夜精品一区二区三区在线播放| 欧美日韩在线观看一区二区三区| 亚洲精选成人| 亚洲网站视频福利| 欧美图区在线视频| 亚洲图片欧美一区| 欧美电影在线观看| 欧美激情中文字幕乱码免费| 亚洲国产精品v| 玖玖玖免费嫩草在线影院一区| 老鸭窝亚洲一区二区三区| 黄色日韩网站| 欧美va亚洲va香蕉在线| 最新成人av在线| 国产亚洲欧美aaaa| 亚洲国产日韩综合一区| 亚洲国产精品成人综合色在线婷婷| 亚洲精品一区二区三区福利| 久久网站热最新地址| 亚洲欧美日韩电影| 国产一区二区在线观看免费播放| 亚洲欧美日韩在线不卡| 亚洲精品一区二区三区福利| 欧美国产日韩xxxxx| 亚洲国产成人在线视频| 欧美大成色www永久网站婷| 久久九九久精品国产免费直播| 韩曰欧美视频免费观看| 欧美国产日韩在线| 国产精品成人一区二区网站软件| 亚洲视频一区二区| 亚洲在线成人| 国产精品丝袜久久久久久app| 国产婷婷色综合av蜜臀av| 一本综合精品| 亚洲午夜激情| 久久一二三四| 在线一区二区日韩| 国户精品久久久久久久久久久不卡 | 亚洲国产毛片完整版| 亚洲欧美日韩爽爽影院| 亚洲精品欧美日韩| 国产精品一级| 久久中文字幕导航| 亚洲一二三级电影| 国产精品啊啊啊| 久热精品视频在线观看一区| 亚洲一区二区精品| 亚洲福利视频三区| 欧美尤物一区| 中文精品一区二区三区| 亚洲成人资源| 国产曰批免费观看久久久| 欧美日韩三级| 欧美成人精品在线观看| 性8sex亚洲区入口| 亚洲婷婷在线| 夜夜嗨一区二区| 欧美黄污视频| 毛片基地黄久久久久久天堂| 欧美一区二区日韩一区二区| 一本一本久久a久久精品综合妖精 一本一本久久a久久精品综合麻豆 | 在线欧美不卡| 国产午夜亚洲精品不卡| 国产精品igao视频网网址不卡日韩|