• <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下,運(yùn)行總是崩潰(在windows下正常)。
            調(diào)試發(fā)現(xiàn)問題出在下列語句:
               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|
            提示在運(yùn)行時會異常。
             
            查找 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、正確使用輸入輸出流,避開高危函數(shù)。

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

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

            下面是一個網(wǎng)上的小例子。

            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 多彩人生 閱讀(1246) 評論(0)  編輯 收藏 引用


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


            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久久午夜精品| 久久精品国产精品亚洲艾草网美妙| 青青草原综合久久| 久久精品国产色蜜蜜麻豆| 人妻系列无码专区久久五月天| 一本久久a久久精品亚洲| 欧美伊香蕉久久综合类网站| 久久成人精品| 精品久久久久久亚洲| 国内精品人妻无码久久久影院导航| 国内精品九九久久精品| 国产午夜精品理论片久久影视 | 久久婷婷五月综合色高清| 国产精品热久久无码av| 国产精品久久久久久一区二区三区| 三级三级久久三级久久| 久久SE精品一区二区| 国产69精品久久久久久人妻精品| 久久91综合国产91久久精品| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 国产精品99久久久久久www| 久久久久亚洲AV成人网人人网站| 久久精品国产亚洲综合色| 久久婷婷成人综合色综合| 噜噜噜色噜噜噜久久| 久久婷婷五月综合色99啪ak| 伊人久久大香线蕉影院95| 超级碰久久免费公开视频| 午夜精品久久久久久毛片| 久久久无码精品亚洲日韩蜜臀浪潮| 狠狠色丁香久久婷婷综合图片| 国内精品久久久久久不卡影院 | 久久久久99精品成人片直播| 久久www免费人成看片| 亚洲精品无码久久不卡| 亚州日韩精品专区久久久| 免费一级欧美大片久久网| 久久久免费观成人影院| 久久久久综合中文字幕| 亚洲午夜精品久久久久久浪潮| 国产精品99久久久久久董美香|