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

            導航

            統計

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品99久久香蕉国产色戒| 久久精品国产男包| 国产91久久综合| 蜜桃麻豆www久久国产精品| 日韩电影久久久被窝网| 国内精品久久久久影院老司| 久久免费看黄a级毛片| 久久久久久亚洲精品成人 | 欧美一区二区久久精品| 狠狠精品久久久无码中文字幕| 久久精品aⅴ无码中文字字幕不卡| 久久精品国产99国产电影网 | 亚洲国产综合久久天堂| 久久久精品人妻一区二区三区蜜桃| 狠狠色丁香久久婷婷综| 久久亚洲熟女cc98cm| 国产三级精品久久| av无码久久久久不卡免费网站| 久久综合给合综合久久| 伊人色综合久久天天| 99蜜桃臀久久久欧美精品网站| 国内精品久久久久久久影视麻豆| 亚洲综合精品香蕉久久网| 久久夜色撩人精品国产| 国内精品久久久久久久涩爱 | 久久国产V一级毛多内射| 精品国际久久久久999波多野| 久久久久久久91精品免费观看| 很黄很污的网站久久mimi色 | 色综合久久中文色婷婷| 国产Av激情久久无码天堂| 亚洲精品白浆高清久久久久久| 狠狠色丁香久久婷婷综合蜜芽五月| 国产2021久久精品| 久久久91人妻无码精品蜜桃HD| 欧美激情精品久久久久| 亚洲国产成人久久综合碰碰动漫3d | 久久99热只有频精品8| 久久精品国产亚洲AV无码偷窥| 久久久精品人妻一区二区三区四| 久久夜色精品国产噜噜麻豆|