• <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下正常)。
            調(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|
            提示在運行時會異常。
             
            查找 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)計

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            99久久国产主播综合精品| 亚洲精品无码久久毛片| 日韩精品久久无码中文字幕| 国产精品亚洲美女久久久| 国产精品无码久久四虎| 欧美亚洲国产精品久久高清| 999久久久免费精品国产| 午夜精品久久久久成人| A狠狠久久蜜臀婷色中文网| 日本高清无卡码一区二区久久| 亚洲中文字幕无码久久精品1| 久久亚洲国产午夜精品理论片| 无码国内精品久久人妻蜜桃| 久久精品国产99国产电影网 | 久久91精品国产91久久麻豆| 26uuu久久五月天| 人妻精品久久无码区| 无码国内精品久久人妻麻豆按摩| 久久99国产精品久久| 亚洲精品乱码久久久久66| 人人狠狠综合久久亚洲| 精品99久久aaa一级毛片| 精品无码久久久久国产| 国产A三级久久精品| 人妻少妇精品久久| 国产精品久久久久久久午夜片 | 国产精品亚洲综合专区片高清久久久| 精品多毛少妇人妻AV免费久久| 久久狠狠一本精品综合网| 久久综合久久综合久久| 久久久久高潮毛片免费全部播放| 久久久久久国产a免费观看黄色大片 | 久久久久亚洲精品无码网址| 91久久精品91久久性色| 成人国内精品久久久久一区| 亚洲国产精品高清久久久| 免费精品久久天干天干| 亚洲精品国产综合久久一线| 久久久久香蕉视频| 亚洲欧美日韩久久精品| 国内精品伊人久久久久777|