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

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品国产亚洲AV嫖农村妇女| 国产情侣久久久久aⅴ免费| 久久青青国产| 久久99精品国产麻豆| 94久久国产乱子伦精品免费 | 欧美日韩成人精品久久久免费看| 香蕉久久永久视频| www.久久99| 久久99精品国产一区二区三区| 国内精品综合久久久40p| 人妻无码精品久久亚瑟影视| 麻豆AV一区二区三区久久| 无码人妻久久一区二区三区免费丨| 无码8090精品久久一区| 久久影院综合精品| 思思久久精品在热线热| 久久精品亚洲AV久久久无码| 2021国产精品午夜久久| 韩国三级中文字幕hd久久精品| 97精品伊人久久大香线蕉app| 色婷婷久久综合中文久久一本| 国产精品久久久久久久久鸭 | 久久久久久久久波多野高潮| 精品国产热久久久福利| 91性高湖久久久久| 久久九九青青国产精品| 久久国产成人午夜aⅴ影院| 久久久久久国产精品无码超碰| 亚洲欧美伊人久久综合一区二区| 亚洲日本va午夜中文字幕久久 | 久久成人精品视频| 久久99国内精品自在现线| 无码人妻精品一区二区三区久久 | 久久精品国产99国产精品| 亚洲国产成人久久精品99| 国产巨作麻豆欧美亚洲综合久久 | 国产精品久久久久久久久软件 | 狠狠精品干练久久久无码中文字幕| 精品综合久久久久久97超人| 日本精品久久久中文字幕 | 久久青青草原精品国产|