• <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>

            colorful

            zc qq:1337220912

             

            cannot pass objects of non-POD type

            移植代碼到Linux下,運行總是崩潰(在windows下正常)。
            調試發現問題出在下列語句:
               wxString szSiteHead = wxString::Format( wxT("<Location /%s>"), file.GetName() );
            查看編譯記錄有下列警告信息
               warning: cannot pass objects of non-POD type 'class wxString' through '...'; call will abort at runtime|
            提示在運行時會異常。
             
            查找 POD type定義如下:非原生類型
             
            POD stands for Plain Old Data - that is, a struct (or class) with no members except data members. Wikipedia goes into a bit more detail and defines a POD in C++ as "A Plain Old Data Structure in C++ is an aggregate class that contains only PODS as members, has no user-defined destructor, no user-defined copy assignment operator, and no nonstatic members of pointer-to-member type."
             
            代碼更改后OK。
            wxString szSiteHead = wxString::Format( wxT("<Location /%s>"), file.GetName().c_str() );

            ===================================================================================
            ctags: c++ warning "cannot pass objects of non-POD type"

            1、不要忽視編譯時的任何一個 Warning .2、正確使用輸入輸出流,避開高危函數。

            1、printf("Hello %s" ,str.c_str());
            2、cout<<str;

            string 非原生類型 non-POD,編譯器無法把它傳入.

            下面是一個網上的小例子。

            im trying to compile following code
            --------------------sam.cpp---------------------
            #include <string>
            #include <iostream>
            #include <stdarg.h>
            using namespace std;

            void Write( const char* msg, const char* msg2, ...)
            {
            cout <<msg <<" "<<msg2<<endl;
            }

            int main()
            {
            string str("World");
            Write("Hello","Debug out %s" ,str);
            return 0;
            }
            -------------------------------------------

            When i compile this code i get following compilation warning .

            [oracle@sahyagiri test]$ g++ sam.cpp
            sam.cpp: In function `int main()':
            sam.cpp:17: warning: cannot pass objects of non-POD
            type `struct std::string'
            through `...'; call will abort at runtime

            When i run the executable, a.out it fails with Illegal
            instruction eror

            posted on 2012-07-26 12:45 多彩人生 閱讀(1251) 評論(0)  編輯 收藏 引用

            導航

            統計

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久国产亚洲精品麻豆| 国产成人精品免费久久久久| 国产一区二区精品久久凹凸| 久久精品国产欧美日韩| 亚洲精品NV久久久久久久久久 | 亚洲午夜无码AV毛片久久| 欧美成人免费观看久久| 99久久精品费精品国产一区二区| 国内精品久久久久久久影视麻豆| 久久人人爽人人爽人人爽| 久久精品免费一区二区三区| 四虎久久影院| 国产欧美久久一区二区| 99久久香蕉国产线看观香| 91久久婷婷国产综合精品青草| 青青草原综合久久大伊人导航| 久久精品aⅴ无码中文字字幕不卡| 国产福利电影一区二区三区,免费久久久久久久精| 国产一区二区精品久久凹凸| 国内精品久久久久影院一蜜桃| 亚洲性久久久影院| 9191精品国产免费久久| 中文国产成人精品久久不卡 | 久久精品www| 人妻久久久一区二区三区| 久久久中文字幕日本| 国产日韩久久久精品影院首页| 色婷婷综合久久久中文字幕| 狠狠色丁香婷婷久久综合五月| 久久久99精品成人片中文字幕| 久久最新精品国产| 久久国产精品99久久久久久老狼| 久久天天躁狠狠躁夜夜96流白浆| 欧美伊人久久大香线蕉综合| 久久中文精品无码中文字幕| 99久久精品国产一区二区三区| 国产91色综合久久免费| 国内精品久久国产大陆| 国产精品久久久久久一区二区三区| 久久综合给合久久狠狠狠97色69| 久久精品欧美日韩精品|