• <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)問題出在下列語(yǔ)句:
               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)行時(shí)會(huì)異常。
             
            查找 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、不要忽視編譯時(shí)的任何一個(gè) Warning .2、正確使用輸入輸出流,避開高危函數(shù)。

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

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

            下面是一個(gè)網(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 多彩人生 閱讀(1231) 評(píng)論(0)  編輯 收藏 引用


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


            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            伊人久久大香线蕉综合影院首页 | 久久99精品久久只有精品| 久久美女人爽女人爽| 亚洲日本久久久午夜精品| 久久精品国产一区| 18岁日韩内射颜射午夜久久成人| 久久99国产精品二区不卡| 狠狠色婷婷久久一区二区| 99久久精品国产毛片| 久久精品国产亚洲av高清漫画| 日韩va亚洲va欧美va久久| 91精品国产高清久久久久久91| 97久久婷婷五月综合色d啪蜜芽| 欧美日韩精品久久久久| 一本色道久久88加勒比—综合| 久久天天躁狠狠躁夜夜网站| 久久男人中文字幕资源站| 一本久久久久久久| 久久91精品国产91久久小草| 久久综合国产乱子伦精品免费 | 久久人人爽人人爽AV片| 久久久久久狠狠丁香| 7777久久亚洲中文字幕| 久久久久人妻精品一区| 亚洲AV无码久久精品蜜桃| 伊人久久大香线焦AV综合影院| 一本色综合久久| 久久久噜噜噜久久中文字幕色伊伊| 久久亚洲精品无码观看不卡| 久久久91人妻无码精品蜜桃HD| 国产巨作麻豆欧美亚洲综合久久| 女人香蕉久久**毛片精品| 久久婷婷综合中文字幕| 色偷偷888欧美精品久久久| 热久久这里只有精品| 91久久精品视频| 精品国产91久久久久久久a| 久久99精品国产99久久6| 看全色黄大色大片免费久久久| 久久午夜无码鲁丝片午夜精品| 污污内射久久一区二区欧美日韩 |