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

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            亚洲国产精品无码久久一区二区 | 91久久精品91久久性色| 久久香蕉国产线看观看精品yw| 中文精品久久久久人妻不卡| 国产精品一区二区久久| 99久久免费国产精品| 麻豆av久久av盛宴av| 久久99国产亚洲高清观看首页| 国产69精品久久久久9999| 亚洲一级Av无码毛片久久精品| 日韩人妻无码一区二区三区久久| 亚洲一本综合久久| 2021久久精品免费观看| 情人伊人久久综合亚洲| 伊人久久大香线蕉av不变影院| 精品久久久久久无码中文字幕| 中文字幕乱码人妻无码久久| 国产毛片久久久久久国产毛片 | 韩国三级大全久久网站| 无码8090精品久久一区| 色综合久久精品中文字幕首页| 久久久国产99久久国产一| 成人亚洲欧美久久久久| 97久久精品国产精品青草| 久久午夜无码鲁丝片秋霞| 久久精品国产一区二区| 精品国产一区二区三区久久| 欧美喷潮久久久XXXXx| 亚洲国产精品成人久久蜜臀| 国内精品伊人久久久久网站| 久久美女人爽女人爽| 狠狠88综合久久久久综合网 | 久久久久夜夜夜精品国产| 青草国产精品久久久久久| 久久无码国产专区精品| 亚洲欧洲久久久精品| 久久婷婷色香五月综合激情| 久久久久亚洲精品无码网址 | 久久国产精品久久| 99精品久久精品| 欧美日韩中文字幕久久伊人|